Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano Error - Net::SSH::HostKeyMismatch

Tags:

I'm completely new to Capistrano and to Ruby, and I can't seem to get basic deployment set up. Every time I run cap deploy:check I get the following error:

servers: ["domain.com"] connection failed for: [email protected] (Net::SSH::HostKeyMismatch: fingerprint 0c:de:d4: 1b:e9:64:83:3a:8b:d7:c3:42:98:5b:5d:8c does not match for "[domain.com]:22,[62.39.11.2]:22" )

My deploy.db looks like this:

set :stages, %w(production staging) set :default_stage, "staging" require 'capistrano/ext/multistage'  set :application, "captest" # TODO set :repository, "[email protected]:jy312/captest.git" # TODO set :scm, :git set :use_sudo, false  ssh_options[:forward_agent] = true default_run_options[:pty] = true set :deploy_via, :remote_cache set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules"] set :git_enable_submodules, 1 

I've tried adding my local computers public key (id_rsa.pub) to the list of known_hosts on my server with no luck.

Any suggestions would be greatly appreciated. Thanks a lot for the help.

like image 798
jg314 Avatar asked Aug 14 '13 22:08

jg314


2 Answers

The destination server's fingerprint is not matching what is in your local known_hosts file. Remove the existing entry in your local known_hosts file.

You can also try fixing the issue by directly SSH'ing to the server instead of going through ruby since it's an SSH issue.

like image 69
Musannif Zahir Avatar answered Sep 18 '22 08:09

Musannif Zahir


or just rewrite it by (change USERNAME and IP of your server):

$ ssh-keygen -f "/home/USERNAME/.ssh/known_hosts" -R 178.X.X.X 

then enter the server

$ ssh [email protected] 

and answer yes

retry deploy

good luck ;)

like image 30
itsnikolay Avatar answered Sep 21 '22 08:09

itsnikolay