git 报错 Connection reset by 20.205.243.160 port 22 解决

在某天愉快地拉取代码时突然发现拉不了了:

$ git pull
kex_exchange_identification: read: Connection reset by peer
Connection reset by 20.205.243.160 port 22
fatal: Could not read from remote repository.

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

个人认为这可能是 github.com 又被墙了导致的。

解决方法:使用 connect 工具代理 ssh 连接。

首先安装 connect 工具:

# macOS
brew install connect
# Ubuntu / Debian
sudo apt install connect-proxy

编辑 ~/.ssh/config

Host github.com
    HostName ssh.github.com
    User git
    Port 443
    IdentityFile ~/.ssh/id_rsa
    ProxyCommand connect -H 127.0.0.1:7890 %h %p

参考:【github】Connection reset by 20.205.243.160 port 443 | CSDN

posted @ 2024-11-20 18:18  Undefined443  阅读(83)  评论(0编辑  收藏  举报