git设置ss代理

// 查看当前代理设置

git config --global http.proxy

http/https协议

//设置代理(clone https://前缀的repo会走代理)

git config --global http.proxy 'http://127.0.0.1:1080'

git config --global https.proxy 'http://127.0.0.1:1080'

git config --global http.proxy 'socks5://127.0.0.1:1080'

git config --global https.proxy 'socks5://127.0.0.1:1080' 

删除
git config --global --unset http.proxy
git config --global --unset https.proxy
 
SSH协议

配置一个 proxy-wrapper 脚本

cat > $HOME/bin/proxy-wrapper
#!/bin/bash
nc -x 127.0.0.1:080 -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 [email protected]:jjrdn/node-open.git

猜你喜欢

转载自www.cnblogs.com/brainworld/p/9339709.html