有的时候我们会遇到git push到GitHub失败的情况,设置代理可能会解决这个问题。

全局设置

设置代理

1
2
git config --global http.proxy http://127.0.0.1:1080
git config --global http.proxy socks5h://127.0.0.1:1080

取消代理

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

只针对对github.com设置

设置代理

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

取消代理

1
git config --global --unset http.https://github.com.proxy