`git config --global http.proxy 代理地址`
`git config --global https.proxy 代理地址`
这种方法是不会起作用的,因为很多 repo 用的是 SSL 的地址,SSL 的地址不会使用 http 和 https 的 proxy。
真正的解决方法是使用 SSL 的 proxyCommand
在你的.ssh/config 中加入这么一行:
···
Host
github.com Hostname
github.com User XXXX
IdentityFile /home/XXXX/.ssh/id_rsa
ProxyCommand /bin/nc -X5 -x 172.0.0.2:1080 %h %p
···
最后一行会让 git 使用 172.0.0.2:1080 地址的 socket5 代理。我的 linux 跑在 VM 里,这个地址是我 windows 上的 s-s 的地址。
我这边上海电信可以轻松下载到 10MB/s