如何给Git设置ssh代理

由于不可描述的原因,在某些情况下Github不可用(git push和git pull都显示远程服务器不可用或无权限),于是就想到上代理。
首先网上搜索一通,发现如下方法:

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

几轮折腾之后,发现然并卵,继续搜索,发现终极方法:

#在~/.ssh/路径下创建config空文件,然后粘贴如下内容:
Host github.com
ProxyCommand connect -S 127.0.0.1:1080 %h %p

重新打开git窗口,git push和git pull都可正常使用。

原文地址:https://www.cnblogs.com/isky0824/p/15524338.html