git clone一个github上的项目太慢,设置终端代理

1,943 阅读1分钟

一.不推荐直接用全局代理

因为如果挂了全局代理,这样如果需要克隆coding之类的国内仓库,会奇慢无比。 所以我建议使用这条命令,只对github进行代理,对国内的仓库不影响

git config --global http.https://github.com.proxy https://127.0.0.1:1086
git config --global https.https://github.com.proxy https://127.0.0.1:1086

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

git config --global --unset http.proxy
git config --global --unset https.proxy

二.以上是http代理,ss暴露的是socks5的代理,以下是socks5的代理方法

1.查看自己socks5的端口号

2.记录自己的地址和端口(我的是127.0.0.1:1086)

3.然后输入命令

git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
git config --global https.https://github.com.proxy socks5://127.0.0.1:1086