git代理配置

git http 使用 http proxy

git config http.proxy "http://127.0.0.1:1080"
git config https.proxy "http://127.0.0.1:1080"

git http 使用 https proxy

git config http.proxy "https://127.0.0.1:1080"
git config https.proxy "https://127.0.0.1:1080"
# 自签名https证书需要导入到操作系统中先

git http 使用 socks proxy

git config http.proxy "socks5://127.0.0.1:1080"
git config https.proxy "socks5://127.0.0.1:1080"

git ssh 使用 http proxy

需要安装socat指令

vim ~/.ssh/config
Host github.com
HostName github.com
User git
ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=1080
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

git ssh 使用 https proxy

需要安装proxytunnel指令

vim ~/.ssh/config
Host github.com
HostName github.com
User git
ProxyCommand proxytunnel -q -E -p 127.0.0.1:1080 -d %h:%p
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

git ssh 使用 socks proxy

需要安装nc指令

vim ~/.ssh/config
Host github.com
HostName github.com
User git
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

你可能感兴趣的:(git代理配置)