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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 06, 2013 at 10:21:42AM +0100, Yves Blusseau wrote:

> > 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.
> 
> Thanks Jeff but it's not working.

Hmm. I just double-checked, and it works for me.

> I use git 1.8.15

I assume you mean 1.8.1.5 here.

> My socks proxy listen on my localhost at port 1080 so I do:
> git config --global http.proxy  'socks://127.0.0.1:1080'

That looks right to me.

> But when i try to talk with a git server with http protocol i have:
> [...]
> * 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
> [...]
> * Empty reply from server

If I set up a simple socks proxy with ssh, like:

  ssh -v -D 1080 my-ssh-host

and run the same command, I get:

  * About to connect() to proxy localhost port 1080 (#0)
  *   Trying 127.0.0.1...
  * SOCKS4 request granted.
  * Connected to localhost (127.0.0.1) port 1080 (#0)
  > GET /pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1
  [...]
  < HTTP/1.1 200 OK

and it works. It does look like curl is treating localhost:1080 as a
regular http proxy. What version of libcurl do you have? Is there
anything in your environment that might be causing it to override the
configured proxy setting (e.g., an http_proxy or https_proxy environment
variable)?

> As you can see git connect to my socks proxy (Connected to 127.0.0.1
> (127.0.0.1) port 1080) but seems to send the http request directly
> instead of a socks command. So it does'nt work :(

Yeah, that definitely looks like the problem.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]