【发布时间】:2020-05-11 13:56:04
【问题描述】:
我的 ~/.ssh/config
Host MyAzureAlias
HostName ssh.myhostname.azure.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_azure_key
Host MyBitbucketAlias
HostName bitbucket.org
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_bitbucket_key
然后我跑
ssh-add -K ~/.ssh/id_rsa_azure_key
ssh-add -K ~/.ssh/id_rsa_bitbucket_key
然后我打开了 webstorm 并打开了两个项目。我拉了bitbucket。成功。 我在 azure 上进行了拉动,但出现错误:remote: Public key authentication failed。致命:无法从远程存储库中读取。请确保您拥有正确的访问权限并且存储库存在。
然后我运行ssh -v MyAzureAlias
在调试中我得到了 debug1: identity file /Users/myname/.ssh/id_rsa_azure_key
最后我得到了 debug1: Authentication succeeded (publickey)。
这意味着我的 MyAzureAlias 的 ~/.ssh/config 工作正常。
然后我运行 ssh-add -l 它给了我两个密钥。
然后我运行 eval "$(ssh-agent -s)" 然后我再次运行 ssh-add -l 并没有给我任何密钥。 p>
然后我跑
- eval "$(ssh-agent -s)"
- ssh-add -K ~/.ssh/id_rsa_azure_key
然后git pull成功。
配置:
- macOS Catalina 10.15.4.
- git 版本 2.24.1 (Apple Git-126)
- ssh -V OpenSSH_8.1p1,LibreSSL 2.7.3
如何解决这个问题?
提前谢谢你!
【问题讨论】:
标签: git azure ssh ssh-agent ssh-config