You are getting when connecting via SSH or deploying with Capistrano (which uses SSH):
Too many authentication failures for username
This is caused by having too many SSH keys added to your keyring or ssh-agent. Your ssh-agent will throw all keys against a server until one matches. Most servers will deny access after 5 attempts.
This issue might come and go as the order of the active SSH keys in your ssh-agent changes.
Have less keys. Up to 5 keys are fine when the SSHD you're connecting to is using the default config.
Every fix that involves you keeping many keys will cause you pain.
ssh-add -D". "
ssh-add -l" should now be empty.
You can tell your SSH client which keys to use for which host. Change your
~/.ssh/config file like this:
Host * IdentitiesOnly yes Host github.com github User your-user Hostname github.com RSAAuthentication yes Compression yes IdentityFile ~/.ssh/your-user.key
You will now be able to connect to github.com and any other host you list in the file, but you can now no longer connect to an unlisted host.
Also you will still be out of luck with Capistrano.
Net::SSH isn't very smart about using your ssh-agent. Basically whenever it sees a running ssh-agent it tries to connect with all added keys. Also it ignores your SSH-config and any settings like
ssh_settings[:keys] = ['~/.ssh/foo.key'] when an ssh-agent is running.
Here is a horrible fix: Monkey patch your deploy.rb so the agent is not used:
class Net::SSH::Authentication::KeyManager def use_agent? false end end
This will probably break the deploy script for every other person working on the same project and cause you all sorts of bad karma.