Capistrano Error - Net::SSH::HostKeyMismatch

jg314 picture jg314 · Aug 15, 2013 · Viewed 15.1k times · Source

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.

Answer

Musannif Zahir picture Musannif Zahir · Aug 15, 2013

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.