Skip to content

Instantly share code, notes, and snippets.

@goncha
Last active January 20, 2020 17:20
Show Gist options
  • Save goncha/4591538 to your computer and use it in GitHub Desktop.
Save goncha/4591538 to your computer and use it in GitHub Desktop.
Git and socks5 proxy
gang@debian:~$ sudo apt-get install netcat-openbsd
gang@debian:~$ cat /usr/local/bin/git-proxy-wrapper
#!/bin/bash
nc -xlocalhost:1080 -X5 $*
gang@debian:~$ export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy-wrapper
@wedojava
Copy link

这样就能在目前严峻的中华大局域网的环境下push到github了?

@ilario
Copy link

ilario commented Oct 20, 2015

I substituted "nc" with "nc.openbsd", then make the script executable with "chmod a+x" and then worked. Thanks!

@MatrixMuto
Copy link

新一点的Git版本,用下面的配置就可以了,
git config --global http.proxy 'socks5://127.0.0.1:7070'
git config --global https.proxy 'socks5://127.0.0.1:7070'
参考

@acgpiano
Copy link

@MatrixMuto
你没搞懂,你那个是git走的是http(s)协议,需要的是git协议走socks
git clone git@xxxxx
而不是
git clone http://xxxxx

@coin8086
Copy link

那个GIT_PROXY_COMMAND基本没有用,完整、实用的设置看这里
https://gist.github.com/coin8086/7228b177221f6db913933021ac33bb92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment