gpt4 book ai didi

git - 无法通过ssh连接到github

转载 作者:IT王子 更新时间:2023-10-29 01:28:07 29 4
gpt4 key购买 nike

我试图从我新安装的运行带有 fluxbox 的 manjaro 的 linux 机器上克隆我在 github 上的一个存储库。我设置了 user.name 和 user.email 并上传了正确的 ssh key 。但我总是得到

The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

我在谷歌上搜索了一下,发现我应该执行 ssh-keygen -R github.com 这应该从我的 known_hosts 文件中删除 github 但 known_hosts 文件甚至还不存在,因为我刚刚完成设置新的 Linux 安装。

所以我尝试了 ssh -vT git@github 这给了我

ssh -vT git@github.com
OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.252.128] port 22.
debug1: Connection established.
debug1: identity file /home/masterkraft0r/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/masterkraft0r/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
The authenticity of host 'github.com (192.30.252.128)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.

这让我难以理解。谁能告诉我出了什么问题,也许如何解决这个问题?

最佳答案

您是否尝试将 github 添加为已知主机?

如果您有一个现有的 known_hosts 文件并且不想覆盖(正如@Puce 在评论中建议的那样),请使用它。

ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

这会将 rsa key 添加到 known_hosts 的末尾。

如果您不知道known_hosts 是什么/意味着什么,或者您从未确定使用它,您可以简单地编写一个新的,但请注意,如果您有,这将删除现有的任何。

ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts

关于git - 无法通过ssh连接到github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32386975/

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