访问github经常失败,使用代理可以使访问更加顺滑。
格式
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:port
git config --global https.proxy https://proxyUsername:proxyPassword@proxy.server.com:port
git config --global http.http://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
git config --global https.https://domain.com.proxy https://proxyUsername:proxyPassword@proxy.server.com:port
以下是例子:
http代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
socks5代理
git config --global http.proxy socks5://127.0.0.1:1081
仅为github.com设置代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1081
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
查看当前的代理配置
git config --global --get http.proxy
git config --global --get https.proxy