Skip to content

Instantly share code, notes, and snippets.

@joho
Created March 8, 2012 10:48
Show Gist options
  • Save joho/2000371 to your computer and use it in GitHub Desktop.
Save joho/2000371 to your computer and use it in GitHub Desktop.
Fix 'Host key verification failed.' errors by using this cap task
# Add this to your capfile if you're getting burned on first deploy to a new host
# If you're getting 'Host key verification failed.' errors on your initial
# checkout of a repo using capistrano, this will fix it up
task :a_friend_of_mine_is_a_friend_of_yours do
# transfer what *I* know about github to the host
github_known_hosts_line = `cat ~/.ssh/known_hosts | grep github.com`
run "echo #{github_known_hosts_line} >> ~/.ssh/known_hosts"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment