Git设置代理

设置本地代理

1
2
3
4
5
6
7
8
9
10
11
# 设置HTTP代理
git config --global http.proxy http://127.0.0.1:1080

# 设置HTTPS代理
git config --global https.proxy http://127.0.0.1:1080

# 重置HTTP代理
git config --global --unset http.proxy

# 重置HTTPS代理
git config --global --unset https.proxy

如果你使用的是ss,则需要将协议换为socks5

1
2
3
git config --global http.proxy 'socks5://127.0.0.1:1080'

git config --global https.proxy 'socks5://127.0.0.1:1080'

针对特定网址设置代理

1
2
3
4
5
# 针对特定网址,例如:Github
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080

# 取消代理
git config --global --unset http.https://github.com.proxy
------------- 本文结束 感谢您的阅读 -------------

本文标题:Git设置代理

文章作者:ZeFeng.Chen

发布时间:2020年01月14日 - 14:19

最后更新:2020年01月14日 - 15:44

原始链接:http://chenzefenghi.github.io/2020/01-14/Git-Proxy/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。