The problem is, you are trying to use the public key for authentication. The private key, is e.g. id_rsa2 while the public key is id_rsa2.pub, at least per default, when generated with ssh-keygen.
As default ssh uses id_rsa for identification, so you have to use:
ssh -i ~/.ssh/id_rsa2 -T git@github.com
The ssh config should look like this:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa2
The
Host
value is important, because that's what you have to use to use the configuration. You now can use ssh github.com
. If you don't change the Host
line, you need to use ssh github
, but this could break other tools.
Alternatively you could use ssh-agent. In this case you do not need to create the config and just add the key to your ssh-agent and ssh to github.
ssh-add ~/.ssh/id_rsa2
ssh -T git@github.com
No comments:
Post a Comment