kex_exchange_identification: Connection closed by remote hostConnection closed by ::1 port 22

kex_exchange_identification: Connection closed by remote hostConnection closed by ::1 port 22

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Gb5Dn0oc-1659776217721)(../my_images/329196143531489095f966b40b2329f2.png)]

缘起
  • 拉代码仓库出错,还挺常见

https 错误原因:

fatal: unable to access ‘https://github.com/jing-zhi/go-sword-admin.git/’: SSL certificate problem: unable to get local issuer certificate

ssh 错误原因:

kex_exchange_identification: Connection closed by remote host
Connection closed by ::1 port 22
fatal: Could not read from remote repository.

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

jingz@jing-zhi- MINGW64 /d/sanyue_project/sanyue-框架
$ git clone https://github.com/jing-zhi/go-sword-admin.git
Cloning into 'go-sword-admin'...
fatal: unable to access 'https://github.com/jing-zhi/go-sword-admin.git/': SSL certificate problem: unable to get local issuer certificate

jingz@jing-zhi- MINGW64 /d/sanyue_project/sanyue-框架
$ git clone git@github.com:jing-zhi/go-sword-admin.git
Cloning into 'go-sword-admin'...
kex_exchange_identification: Connection closed by remote host
Connection closed by ::1 port 22
fatal: Could not read from remote repository.

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

推测原因之一:github的邮箱地址和git global的email不一样

git config --global user.email  "jingzhi736728@163.com" // 设置成和我在github账号一样的邮箱
$ ssh-keygen –t rsa –C "jingzhi736728@163.com"  // 重新生成key
结果——失败了,依旧报同样错

推测其他原因等…

$ ssh -T git@github.com

检查github公钥配置情况出错。

根据报错原因,推测可能是22端口把他关闭了,先检查一下22端口号是否开启
netstat -na

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AAyQ9vgN-1659776217723)(../my_images/9809f9f1450e4d6e8f271224b993700a.png)][外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-vKpYETAd-1659776217724)(data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==)]编辑

如图是开启的

真正原因

之前国内对github完全封死,造成DNS域名解析错误,即便翻外网进去也不能直接拉代码了。需要一点配置

然而我有个好兄弟给我解决了

  • C:\Windows\System32\drivers\etc
  • 在hosts中添加github的ip地址对应:140.82.112.3 github.com

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-buwxpyM7-1659776217724)(../my_images/image-20220806165447742.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JNBz9Hwk-1659776217725)(../my_images/image-20220806165453670.png)]

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不之道

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值