Git通过SSH拉取报错kex_exchange_identification

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 dreambirdXXX@github.com

@符前面是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

 现在看一下能不能拉取

 拉取成功啦

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值