有时从github.com克隆代码, 奇慢, 有时只有几K/s, 设置完代理后,直接起飞
设置代理
1 2 3 | //1080为本地的ss代理服务器的端口 $ git config --global http.proxy socks5://127.0.0.1:1080 $ git config --global https.proxy socks5://127.0.0.1:1080 |
取消代理
1 2 | $ git config --global --unset http.proxy $ git config --global --unset https.proxy |
github ssh proxy的配置
配置一个
proxy-wrapper
脚本cat > $HOME/bin/proxy-wrapper
#!/bin/bash
nc -x127.0.0.1:7080 -X5 $*
给它增加一个可执行权限
$ chmod +x $HOME/bin/proxy-wrapper
配置
.ssh/config
, 对 github.com 设置一个代理命令Host github github.com
Hostname github.com
User git
ProxyCommand $HOME/bin/proxy-wrapper '%h %p'
必须全部走ssh协议
$ git clone git@github.com:jjrdn/node-open.git
git 协议请参考 Using GIT through a SOCKS proxy.