刚才在使用github时,发现直接下载zip的时候,速度非常快,但是使用git clone时发现速度只有15kb/s左右。这一定是不合理的。
想着使用梯子,下载速度应该会有所提升,结果发现速度居然没有变化。
通过一番查找,发现网上有修改host的方法,一步一步做下来,发现速度还是一样。
最后,终于在https://blog.csdn.net/weixin_34248258/article/details/93164003中发现,是因为git clone根本不会走全局代理。
需要使用以下几个命令:
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
git config --global https.https://github.com.proxy socks5://127.0.0.1:1080
git config --global http.https://github.com.proxy https://127.0.0.1:1081
git config --global https.https://github.com.proxy https://127.0.0.1:1081
需要注意的有两点:
1. 在shadowsocks中,会有socks5和https的选择。如下图,我的设置127.0.0.1,1080, HTTPS
所以我应该在terminal中输入:
git config --global http.https://github.com.proxy https://127.0.0.1:1080
git config --global https.https://github.com.proxy https://127.0.0.1:1080
修改之后,我的下载速度在1MB/S左右,说明VPN已经加速了clone的速度。