gpt4 book ai didi

git - 在 Git Bash 中显示 SSH key 文件

转载 作者:IT王子 更新时间:2023-10-29 00:42:58 29 4
gpt4 key购买 nike

如何查看 Git Bash 中使用的是哪个 SSH key 文件?

我尝试了“git config --get-all”,但我收到了错误消息

error: wrong number of arguments; usage: git config [options]

最佳答案

使用哪个 SSH key 不是由 Git 决定的,而是由 SSH 客户端本身决定的。在 ~/.ssh/config 中配置适当的 key ,或者 ssh 在连接到主机时尝试它可以找到的所有 key 。您可以通过使用标准 SSH 客户端连接到主机来查看哪个 key 最终成功。例如,使用 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 ****
[...]

这告诉您 key .../id_rsa2 是服务器接受的 key 。

关于git - 在 Git Bash 中显示 SSH key 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18845799/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com