Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created keys for git following instructions on

This works nice, but when I try to ssh to another host, it tries to use same public key. Also, ssh to servers without public key, but password authentication fails with

$ssh user@host
Permission denied (publickey,password).

How can I solve this to use default keys for github, but not for other hosts?

I saw this but I don't want to add entry for each host, I want other to behave like I don't have any keys configured and ask for password.

share|improve this question
up vote 1 down vote accepted

Rename your GitHub key so that it doesn't use any of the default key files which ssh looks for (something like ~/.ssh/id_rsa_github). Then add the following to ~/.ssh/config to tell ssh to only use this key for connections to GitHub.

Host *
    IdentityFile ~/.ssh/id_rsa_github

All other connections won't attempt key authentication because there aren't default keys. However, there is usually no harm in this happening -- if the key is rejected, ssh will attempt password authentication if it is available.

share|improve this answer

use your .ssh/config and the IdentityFile expression:

Specifies a file from which the user's RSA or DSA authentication identity is read. The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version 2. Additionally, any identities represented by the authentication agent will be used for authentication.

then refer to .ssh/id_rsa_github (or whatever the name of your 'for github only` keypair is')

share|improve this answer
Thanks. But when I use -i it does not accept passphrase, and after 3 nonsuccessive attempts I get Permission denied (publickey,keyboard-interactive).. Also, I still don't understand how to force no key to use, but use password auth? – umpirsky Mar 19 '12 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .