git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Using socks proxy with git for http(s) transport

From
YBYves Blusseau <yves.blusseau@gmail.com>
Date
Mar 6, 2013, 09:35 UTC
Message-ID
<CABmRxH1=wjXXLDTCAO2Ge9YcBJq4yJQd4-NUs9P=qKWzh8kkjw@mail.gmail.com>
In-Reply-To
<20130306082110.GA31638@sigill.intra.peff.net>
2013/3/6 Jeff King <peff@peff.net>:
Show 10 quoted lines
> Try:
>
>   git config --global http.proxy 'socks://yourhost:port'
>
> That will enable it for all git repositories on your machine. Git should
> also respect any environment variables that curl handles (because we use
> libcurl under the hood), if you prefer to set it up that way. See "man
> curl" for details.
>
> -Peff

Also try setting ALL_PROXY environment variable that curl handle: export ALL_PROXY='socks5://127.0.0.1:1080'

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

* About to connect() to proxy 127.0.0.1 port 1080 (#0)
*   Trying 127.0.0.1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:--
--:--:--     0* 198
* 145
* 20
* 140
* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#0)
Show 5 quoted lines
> GET /pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1
> User-Agent: curl/7.29.1-DEV
> Host: git.kernel.org
> Accept: */*
>

< HTTP/1.1 200 OK < Server: nginx < Date: Wed, 06 Mar 2013 09:33:05 GMT < Content-Type: application/x-git-upload-pack-advertisement < Transfer-Encoding: chunked < Connection: keep-alive < Expires: Fri, 01 Jan 1980 00:00:00 GMT < Pragma: no-cache < Cache-Control: no-cache, max-age=0, must-revalidate < { [data not shown]

But with git (without the http.proxy configuration in .gitconfig):
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone
http://git.kernel.org/pub/scm/git/git.git
trace: built-in: git 'clone' 'http://git.kernel.org/pub/scm/git/git.git'
Cloning into 'git'...
trace: run_command: 'git-remote-http' 'origin'
'http://git.kernel.org/pub/scm/git/git.git'
* Couldn't find host git.kernel.org in the .netrc file, using defaults
* About to connect() to proxy 127.0.0.1 port 1080
*   Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 1080
> GET http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.8.1.5
Host: git.kernel.org
Accept: */*
Accept-Encoding: gzip
Proxy-Connection: Keep-Alive
Pragma: no-cache
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
error: Empty reply from server while accessing
http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack
fatal: HTTP request failed

Regards, Yves

Previous: Daniel StenbergNext: ciorapalb100
Message 7 of 8 in “Using socks proxy with git for http(s) transport”
  1. Yves BlusseauMar 6, 2013
  2. Jeff KingMar 6, 2013
  3. Yves BlusseauMar 6, 2013
  4. Jeff KingMar 6, 2013
  5. Yves BlusseauMar 6, 2013
  6. Daniel StenbergMar 6, 2013
  7. Yves BlusseauMar 6, 2013
  8. ciorapalb100Jun 15, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.