在git bash中显示ssh密钥文件 [英] Show ssh key file in git bash
问题描述
如何查看在git bash中使用哪个ssh密钥文件。我尝试了git config --get-all,但是我收到错误信息error:arguments of number of arguments; usage:git config [options]
How can see which ssh key file is used in the git bash. I tried "git config --get-all" but I get the error message "error: wrong number of arguments; usage: git config [options]"
推荐答案
使用的SSH密钥不是由git决定的,而是由SSH客户端自己决定的。可以在〜/ .ssh / config
或 ssh
中配置适当的密钥,只需尝试所有可以找到的密钥连接到主机。通过使用标准SSH客户端连接到主机,您可以看到最终成功的密钥。例如,在使用Github时:
Which SSH key is used isn't determined by git, but by the SSH client itself. Either the appropriate key is configured in ~/.ssh/config
, or ssh
just tries all keys it can find when connecting to the host. You can see which key ultimately succeeded by connecting to the host with the standard SSH client. For example, when using Github:
ssh -v git@github.com
这会给你一些这样的东西:
This will give you something a bit like this:
[...]
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
是服务器接受的关键字。
This tells you that the key .../id_rsa2
was the one accepted by the server.
这篇关于在git bash中显示ssh密钥文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!