【高手】如何优雅的解决git超时

349 阅读1分钟

Failed to connect to proxy.server.com port 8080: Operation timed out

全局代理

后来查看是否使用代理:

git config --global http.proxy

然后取消代理:

git config --global --unset http.proxy

然后再拉去则成功!

若还需要重设代理,则:

git config --global http.proxy http://127.0.0.1:1088

再次查看是否使用代理:

git config --global http.proxy

则配置代理成功

优化全局代理

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

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

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

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

:smile:以上就是如何利用代理解决git超时。