如何查看Git Bash中使用了哪个SSH密钥文件?
我尝试了“ git config --get-all”,但收到错误消息
错误:参数数量错误;用法:git config [选项]
Answers:
使用哪个SSH密钥不是由Git决定的,而是由SSH客户端本身决定的。可以在中配置适当的密钥~/.ssh/config,也ssh可以尝试连接主机时找到的所有密钥。您可以通过使用标准SSH客户端连接到主机来查看哪个密钥最终成功。例如,当使用GitHub时:
ssh -v git@github.com
这会给你这样的东西:
[...]
debug1: Offering RSA public key: /home/me/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /home/me/.ssh/id_rsa2
debug1: Server accepts key: pkalg ssh-rsa blen ****
[...]
这告诉您密钥.../id_rsa2是服务器接受的密钥。
另一个解决方案,在最新的Git Bash中,您可以输入:
$ git-gui
然后将执行GUI应用程序,在GUI中,您只需单击“帮助” →“显示SSH密钥”以显示SSH密钥。