git设置代理

2020-10-14  本文已影响0人  风轻云淡_z

git的协议

git clone git@github.com:owner/git.git
这种走的是ssh协议,需要设置ssh代理

git clone https://github.com/owner/git.git
这种走的是http协议,需要设置http代理

http协议

通过http代理

git config --global http.proxy "http://127.0.0.1:8089"
git config --global https.proxy "http://127.0.0.1:8089"

通过socks5代理

git config --global http.proxy "socks5://127.0.0.1:1089"
git config --global https.proxy "socks5://127.0.0.1:1089"

取消设置

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

查看设置

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

通过ssh协议

修改 ~/.ssh/config 文件(不存在则新建):新增以下内容

Host github.com
ProxyCommand nc -X 5 -x 127.0.0.1:1089 %h %p
上一篇 下一篇

猜你喜欢

热点阅读