设置代理
http 代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
socks5 代理
git config --global http.proxy socks5h://127.0.0.1:1086
git config --global https.proxy socks5h://127.0.0.1:1086
注意 socks5 代理的默认端口号(1086)与 http 代理的默认端口号(1080)不同
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
这里的代理设置是全局的(--global
参数),代理设置会一直生效,代理软件关闭或失效,会导致 git 无法连接,需要取消设置代理使得 git 流量不经过代理。
网友评论