咨询热线:4006-75-4006

售前:9:00-23:30    备案:9:00-18:00    技术:7*24h

Git Pull/Git Push配置SSH代理

2024-08-27 14:28:04 1736次

Git Pull&Git Push配置SSH代理

蓝队云小课堂:


当git pull或push时经常会遇到Could not read from remote repository的报错,尤其是在启用Clash等代理软件后

# git push

kex_exchange_identification: Connection closed by remote host

Connection closed by 20.205.243.166 port 22

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

此时我们可以通过配置SSH代理来保障网络通畅,添加~/.ssh/config文件,配置如下内容

# cat ~/.ssh/config

Host github.com

    User git

    Hostname github.com

    Port 22

    ProxyCommand nc -v -x localhost:7890 %h %p

ProxyCommand依赖nc,服务器上需要提前安装nc

# apt-get install ncat


更多小知识,可联系蓝队云一起探讨。


首页
最新活动
个人中心