无法通过ssh连接到github [英] can't connect to github via ssh

查看:204
本文介绍了无法通过ssh连接到github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从我新安装的使用fluxbox运行manjaro的Linux机器上克隆我的一个github仓库。我设置了user.name和user.email并上传了正确的ssh密钥。但我总是得到

 主机'github.com(192.30.252.129)'的真实性无法建立。 
RSA密钥指纹是SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8。
您确定要继续连接(是/否)吗?
主机密钥验证失败。
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限并存在存储库。

我搜索了它,发现我应该做 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 2015年7月9日
debug1:读取配置数据/ etc / ssh / ssh_config
debug1:连接到github .com [192.30.252.128]端口22.
debug1:建立连接。
debug1:身份文件/home/masterkraft0r/.ssh/id_rsa类型1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件/home/masterkraft0r/.ssh/id_rsa-证书类型-1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件/home/masterkraft0r/.ssh/id_dsa类型-1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件/home/masterkraft0r/.ssh/id_dsa-cert类型-1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件/home/masterkraft0r/.ssh / id_ecdsa类型-1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件/home/masterkraft0r/.ssh/id_ecdsa-cert类型-1
debug1:key_load_public:No such文件或目录
debug1:身份文件/home/masterkraft0r/.ssh/id_ed25519类型-1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件/ home / masterkraft0r /。 ssh / id_ed25519-cert类型-1
debug1:启用兼容模式协议2.0
debug1:本地版本字符串SSH-2.0-OpenSSH_7.1
debug1:远程协议版本2.0,远程软件版本libssh-0.7.0
debug1:不匹配:libssh-0.7 .0
debug1:验证到github.com:22作为'git'
debug1:SSH2_MSG_KEXINIT发送
debug1:SSH2_MSG_KEXINIT收到
debug1:kex:服务器>客户端chacha20- poly1305@openssh.com<隐含> none
debug1:kex:client->服务器chacha20-poly1305@openssh.com< implicit> none
debug1:期望SSH2_MSG_KEX_ECDH_REPLY
debug1:服务器主机密钥:ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
主机'github.com(192.30.252.128)'的真实性无法建立。
RSA密钥指纹是SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8。
您确定要继续连接(是/否)吗?
主机密钥验证失败。

这是我的头脑。有人可以告诉我出了什么问题,也许该如何解决这个混乱问题?

解决方案

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



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

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

这会将rsa密钥添加到known_hosts的末尾。 p>

如果您不知道 known_hosts 是/是否意味着,或者您从来没有使用它,那么您可以简单地写一个新的,但注意,这将删除现有的一个,如果你有任何。

  ssh-keyscan -t rsa github。 com> 〜/ .ssh / known_hosts 


I tried to clone one of my repositories on github from my newly installed linux machine running manjaro with fluxbox. i set up the user.name and user.email and uploaded the correct ssh key. but i always get

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.

I googled it and found that i should do ssh-keygen -R github.com which should delete github from my known_hosts file but the known_hosts file doesn't even exist yet, because i just finished setting up a new linux install.

so i tried ssh -vT git@github which gave me

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.

which is way over my head. can somebody tell me what went wrong and maybe how to fix this mess?

解决方案

Did you try to add github as known host?

If you have an existing known_hosts file and do not want to overwrite (as @Puce suggested in the comment), use this.

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

This will add the rsa key to the end of the known_hosts.

If you have no idea what known_hosts is/means, or you never engaged with it for sure, you can simply write a new one, but note that this will remove the existing one if you had any.

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

这篇关于无法通过ssh连接到github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆