mac环境下往码云提交代码出现ex_exchange_identification: read: Connection reset by peer Connection reset by 180.97

mac环境下往码云提交代码出现ex_exchange_identification: read: Connection reset by peer Connection reset by 180.97.125.228 port 22解决办法。

昨天都好好的,今天突然提交代码突然出现这种问题 kex_exchange_identification: read: Connection reset by peer Connection reset by 180.97.125.228 port 22,在网上找了很多方法,重写生成公钥等都没解决,不过运气还是不错,又找了二十多分钟,终于找到了解决办法。

image-20230111224808060

首先找到host文件,hosts 文件就在 /etc/hosts 路径里,我们直接是无法编辑的,需要通过下面的方法来修改我们的 hosts 文件。

进入终端(命令窗口)里,输入 sudo vi /etc/hosts ,回车后再输入密码,再回车就可以打开我们的hosts文件了。

sudo vi /etc/hosts  

这个时候查看我们的提交代码的时候的报错信息

kex_exchange_identification: read: Connection reset by peer
Connection reset by 180.97.125.228 port 22
fatal: Could not read from remote repository.

我们需要做的就是打开上面的的host文件,将端口22添加。如图所示。

image-20230111224917105

这个时候在提交代码,就可以看到能正常提交了。

jianguo@jianguodeMBP arkui-book % git push  origin master                
Enumerating objects: 132, done.
Counting objects: 100% (132/132), done.
Delta compression using up to 8 threads
Compressing objects: 100% (99/99), done.
Writing objects: 100% (116/116), 42.50 KiB | 6.07 MiB/s, done.
Total 116 (delta 34), reused 29 (delta 2), pack-reused 0
remote: Resolving deltas: 100% (34/34), completed with 10 local objects.
remote: Powered by GITEE.COM [GNK-6.4]
To gitee.com:jianguo888/arkui-book.git
   da05a94..83a2e37  master -> master

image-20230111225217438

最后真想吐槽一句。

猜你喜欢

转载自blog.csdn.net/qq_39132095/article/details/128652260