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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容