一、针对 http

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

方法一:使用 proxychains 将 ssh 转换成 http

1.安装 proxychains:

yaourt -S proxychains

2.修改 /etc/proxychains.conf 文件:

注释掉下面的两行

proxy_dns

socks4 127.0.0.1 9050

末尾添加一行

socks5 127.0.0.1 1080

3.使用方法

proxychains git clone git@github.com:lemos1235/TamakosBot.git

方法二:配置 .ssh/config

Host github.com
User git
ProxyCommand nc -x localhost:7890 %h %p

相关文章: