-
-
Save laispace/666dd7b27e9116faece6 to your computer and use it in GitHub Desktop.
git config --global https.proxy http://127.0.0.1:1080 | |
git config --global https.proxy https://127.0.0.1:1080 | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
npm config delete proxy |
实测如下, 详细见: https://gist.github.com/liuyunbin/b6b820ecca264e2768e6574dc4235763#git
1. http 协议
export https_proxy=http://192.168.68.1:7890; # http 代理 -- 建议
git clone https://github.com/liuyunbin/note; # 测试export https_proxy=socks://192.168.68.1:7890; # socks 代理 -- 域名解析失败
git clone https://github.com/liuyunbin/note; # 测试export https_proxy=socks4://192.168.68.1:7890; # socks4 代理 -- 域名解析失败
git clone https://github.com/liuyunbin/note; # 测试export https_proxy=socks4a://192.168.68.1:7890; # socks4a 代理 -- 建议
git clone https://github.com/liuyunbin/note; # 测试export https_proxy=socks5://192.168.68.1:7890; # socks5 代理 -- 域名解析失败
git clone https://github.com/liuyunbin/note; # 测试export https_proxy=socks5h://192.168.68.1:7890; # socks5h 代理 -- 建议
git clone https://github.com/liuyunbin/note; # 测试git config --global http.proxy http://192.168.68.1:7890; # 设置 http 代理 -- 建议
git clone https://github.com/liuyunbin/note; # 测试
git config --global --unset http.proxy; # 取消代理设置git config --global http.proxy socks://192.168.68.1:7890; # 设置 socks 代理
git clone https://github.com/liuyunbin/note; # 测试 -- 域名解析失败
git config --global --unset http.proxy; # 取消代理设置git config --global http.proxy socks4://192.168.68.1:7890; # 设置 socks4 代理
git clone https://github.com/liuyunbin/note; # 测试 -- 域名解析失败
git config --global --unset http.proxy; # 取消代理设置git config --global http.proxy socks4a://192.168.68.1:7890; # 设置 socks4a 代理 -- 建议
git clone https://github.com/liuyunbin/note; # 测试
git config --global --unset http.proxy; # 取消代理设置git config --global http.proxy socks5://192.168.68.1:7890; # 设置 socks5 代理
git clone https://github.com/liuyunbin/note; # 测试 -- 域名解析失败
git config --global --unset http.proxy; # 取消代理设置git config --global http.proxy socks5h://192.168.68.1:7890; # 设置 socks5h 代理 -- 建议
git clone https://github.com/liuyunbin/note; # 测试
git config --global --unset http.proxy; # 取消代理设置2. ssh 协议访问
2.1 windows 10 --- git-bash
在 ~/.ssh/config 中添加: --- http 代理 -- 建议
Host github.com
ProxyCommand connect -H 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试在 ~/.ssh/config 中添加: --- socks 代理 -- 建议
Host github.com
ProxyCommand connect -S 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试2.2 centos 7
在 ~/.ssh/config 中添加: --- http 代理 -- 建议
Host github.com
ProxyCommand nc --proxy-type http --proxy 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试在 ~/.ssh/config 中添加: --- socks4 代理 -- 建议
Host github.com
ProxyCommand nc --proxy-type socks4 --proxy 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试在 ~/.ssh/config 中添加: --- socks5 代理 -- 建议
Host github.com
ProxyCommand nc --proxy-type socks5 --proxy 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试2.3 ubuntu 24.04
在 ~/.ssh/config 中添加: --- http 代理 -- 建议
Host github.com
ProxyCommand nc -X connect -x 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试在 ~/.ssh/config 中添加: --- socks4 代理 --- 域名解析失败
Host github.com
ProxyCommand nc -X 4 -x 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试在 ~/.ssh/config 中添加: --- socks5 代理 -- 建议
Host github.com
ProxyCommand nc -X 5 -x 192.168.68.1:7890 %h %p
git clone [email protected]:liuyunbin/note; # 测试
thanks a lot!