Reputation: 10149
I am trying to add a new ssh key for my new laptop, but after adding it, it is always rejected for the public key issue, anyone have any ideas to trouble shoot? I am following the exact guide here => https://help.github.com/articles/generating-an-ssh-key/
ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address 'xxx.xx.xxx.xxx' to the list of known hosts.
Permission denied (publickey).
Tried to use ssh-keygen -R github.com, still not working,
$ ssh-keygen -R github.com
# Host github.com found: line 10 type RSA
/Users/xxx/.ssh/known_hosts updated.
Original contents retained as /Users/xxx/.ssh/known_hosts.old
$ ssh -T [email protected]
The authenticity of host 'github.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is (skip fingerprint details here).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
Permission denied (publickey).
regards, Lin
Upvotes: 0
Views: 587
Reputation: 25966
You can set up multiple github identities. It is described even in on several places.
Basic idea is to create two aliases in ~/.ssh/config
:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_work
Host github.com-the-other
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_the-other
and then change the url
in your .git/config
from github.com to
github.com-the-other`. Than the line will look like this:
[remote "origin"]
url = [email protected]:the-other/gfs.git
Upvotes: 1