Skip to content

Instantly share code, notes, and snippets.

@panliming-tuya
Last active March 3, 2019 05:44
Show Gist options
  • Save panliming-tuya/03a251ddfbd2418d758d346350f7650b to your computer and use it in GitHub Desktop.
Save panliming-tuya/03a251ddfbd2418d758d346350f7650b to your computer and use it in GitHub Desktop.
git 设置代理

设置代理

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

取消代理

git config --global --unset http.proxy

因为我用的是shadowsocks代理,所以上面是socks5h://, 如果用的是http代理,将socks5h改为http即可

如果仅仅想为github设置代理,可以这样:

git config --global http.https://git.521000.best.proxy socks5h://127.0.0.1:1080

对于使用git@协议的,可以配置socks5代理 在~/.ssh/config 文件后面添加几行(没有可以新建一个)

Host github.com
User git
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p

windows使用:

Host github.com
User git
ProxyCommand connect -S 127.0.0.1:1080 %h %p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment