Git 配置代理
git clone 分 HTTP 形式和 SSH 形式,而这两种形式的都可以走
http
代理和socks5
代理这两种代理
SSH 形式
ssh 形式:git clone git@github.com/xxx/xxx.git
。在
~/.ssh/config
文件添加下面内容 (http 代理或者 socks5
代理):
1 | # GitHub |
HTTP 形式
http 形式:git clone https://github.com/xxx/xxx.git
配置 git 全局代理
通过命令配置:
http 代理
1
2git config --global http.proxy "http://127.0.0.1:7890"
git config --global https.proxy "http://127.0.0.1:7890"socks5 代理
1
2git config --global http.proxy "socks5://127.0.0.1:7890"
git config --global https.proxy "socks5://127.0.0.1:7890"取消代理
1
2git config --global --unset http.proxy
git config --global --unset https.proxy
通过 git 配置文件配置:
vim ~/.gitconfig
加入:
1 | [http] |
配置终端临时代理
1 | # proxy list |