Git拉取数据报错:
kex_exchange_identification: Connection closed by remote host
Connection closed by 140.82.121.3 port 443
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
排查问题步骤:
1、Ping 140.82.121.3
看一下这个ip能不能访问?
我想起我修改过host文件,看一下host文件有没有问题
140.82.121.3 github.com
140.82.121.3 ssh.github.com
通过debug查看为什么报错?
在Git Bash运行指令
ssh -v [email protected]
@符前面是github的用户名
$ ssh -v dreambird25@github.com
OpenSSH_9.0p1, OpenSSL 1.1.1o 3 May 2022
debug1: Reading configuration data /c/Users/Administrator/.ssh/config
debug1: /c/Users/Administrator/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ssh.github.com [140.82.121.3] port 443.
debug1: Connection established.
debug1: identity file /c/Users/Administrator/.ssh/id_rsa type 0
debug1: identity file /c/Users/Administrator/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
kex_exchange_identification: Connection closed by remote host
Connection closed by 140.82.121.3 port 443
可以看到已经建立连接了,说明github上的ssh配置没有问题
但是为什么连接被远程主机关闭了呢?
Git拉取数据用的域名是ssh.github.com
检查一下域名对应的ip有没有140.82.121.3
打开站长工具多个地点ping服务器-网站测速-站长工具
ping ssh.github.com 检测发现很多地区都ping超时,并且下面的独立ip里面并没有发现140.82.121.3由此可见host文件的ip写错了
在独立ip里面找一个能ping通的,很多ip 都超时了,发现了一个ping通的ip
修改host文件
140.82.121.3 github.com
140.82.121.35 ssh.github.com
现在看一下能不能拉取
拉取成功啦
版权归原作者 記億揺晃着的那天 所有, 如有侵权,请联系我们删除。