[转载]github连接速度

来源:互联网 发布:五毛特效是什么软件 编辑:程序博客网 时间:2024/05/30 23:20

作者:汪小九
链接:https://www.zhihu.com/question/27159393/answer/141047266
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

  • 首先第一步前提是已经打开了SS代理;
  • 如果要设置全局代理,可以依照这样设置
git config --global http.proxy http://127.0.0.1:1080git config --global https.proxy https://127.0.0.1:1080
  • 要注意自己的ss端口如果不是1080,要配置成自己的; 完成上面一步后,此时输入
    git clone xxxxxxx
    就可以利用代理进行下载了但同时,也请注意,这里指的是https协议,也就是
    git clone https://www.github.com/xxxx/xxxx.git,

    git clone git@github.com:xxxxxx/xxxxxx.git
    这种,依旧是无效的。
  • 以上为总结,但我不推荐直接用全局代理因为如果挂了全局代理,这样如果需要克隆coding之类的国内仓库,会奇慢无比所以我建议使用这条命令,只对github进行代理,对国内的仓库不影响,
git config --global http.https://github.com.proxy https://127.0.0.1:1080git config --global https.https://github.com.proxy https://127.0.0.1:1080

同时,如果在输入这条命令之前,已经输入全局代理的话,可以输入进行取消

git config --global --unset http.proxygit config --global --unset https.proxy
  • 如果是socks5需要按如下进行配置,同样端口需换成自己的,
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086git config --global https.https://github.com.proxy socks5://127.0.0.1:1086

说一下使用效果:
从5k/s进到20k/s, 也是很感人…