云服务器Git Pull/Git Push配置SSH代理
当gitpull或push时经常会遇到Couldnotreadfromremoterepository的报错,尤其是在启用Clash等代理软件后
#gitpush
kex_exchange_identification:Connectionclosedbyremotehost
Connectionclosedby20.205.243.166port22
fatal:Couldnotreadfromremoterepository.
PleaSEMakesureyouhavethecorrectaccessrights
andtherepositoryexists.
此时我们可以通过配置SSH代理来保障网络通畅,添加~/.ssh/config文件,配置如下内容
#cat~/.ssh/config
Hostgithub.com
Usergit
Hostnamegithub.com
Port22
ProxyCommandnc-v-xlocalhost:7890%h%p
ProxyCommand依赖nc,服务器上需要提前安装nc
#apt-getinstallncat