我正在尝试为我的新笔记本电脑添加一个新的ssh密钥,但是在添加它之后,它总是因公共密钥问题而被拒绝,任何人都有任何想法来解决问题?我在这里遵循确切的指南=> https://help.github.com/articles/generating-an-ssh-key/
ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address 'xxx.xx.xxx.xxx' to the list of known hosts.
Permission denied (publickey).
尝试使用ssh-keygen -R github.com,仍然无效,
$ 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 git@github.com
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).
的问候, 林
答案 0 :(得分:1)
您可以设置多个github标识。甚至在on several places中也有描述。
基本思路是在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
中创建两个别名:
url
然后从.git/config
github.com-the-other`更改github.com to
中的[remote "origin"]
url = git@github.com-the-other:the-other/gfs.git
。比线条看起来像这样:
{{1}}