Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 980 Bytes

github-proxy.md

File metadata and controls

59 lines (41 loc) · 980 Bytes

Github 代理

Http 代理

HTTP

git config --global http.proxy "http://127.0.0.1:8080"
git config --global https.proxy "http://127.0.0.1:8080"

socks5

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 代理

需要先安装 socat 或 nc

brew install socat

brew install nc

配置

vi ~/.ssh/config

输入下面内容:

# 必须是 github.com
Host github.com
   HostName github.com
   User git
   # 走 HTTP 代理
   # ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8080
   # 走 socks5 代理(如 Shadowsocks)
   # ProxyCommand nc -v -x 127.0.0.1:1080 %h %p

References

macOS 给 Git(Github) 设置代理(HTTP/SSH)