Using a socks proxy with git for the http transport

How to make git use a socks proxy for http transport ?

I successed in configuring git with GIT_PROXY_COMMAND to use a socks proxy for GIT transport.

Also i have configured my .curlrc file to defined the socks proxy and i can fetch informations directly with curl command like:

curl http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack

But how to use a socks proxy with git to retrieve data using the http transport protocol like:

git clone http://git.kernel.org/pub/scm/git

I tested with Git 1.8.2 and SOCKS v5 proxy, following setting works for me:

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

UPDATE 2017-3-31:

According to the document, despite the name http .proxy , it should work for both HTTP and HTTPS repository urls. Thanks @user for pointing out this.


如果您不想将代理设置为全局配置,请尝试ALL_PROXY=例如:

$ ALL_PROXY=socks5://127.0.0.1:8888 git clone https://github.com/some/one.git

(稍微提醒一下)如果你希望主机名也可以通过代理解析(这意味着通过代理传递所有内容 ),特别是当你克隆一个要点时 ,你可以使用下面的设置(关键是它使用socks5h代替袜子5 ):

git config --global http.proxy socks5h://127.0.0.1:1080
链接地址: http://www.djcxy.com/p/96454.html

上一篇: git://通过代理

下一篇: 对于http传输使用带git的socks代理