git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Yves Blusseau <yves.blusseau@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Using socks proxy with git for http(s) transport
Date: Wed, 6 Mar 2013 04:45:53 -0500	[thread overview]
Message-ID: <20130306094552.GA11531@sigill.intra.peff.net> (raw)
In-Reply-To: <CABmRxH2CGTxFaGufSMgUqhrSTZPvFBHoEnP8-p5HhkU4kszJPw@mail.gmail.com>

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

  reply	other threads:[~2013-03-06  9:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  8:12 Using socks proxy with git for http(s) transport Yves Blusseau
2013-03-06  8:21 ` Jeff King
2013-03-06  9:21   ` Yves Blusseau
2013-03-06  9:45     ` Jeff King [this message]
2013-03-06 10:09       ` Yves Blusseau
2013-03-06 10:39         ` Daniel Stenberg
2013-03-06  9:35   ` Yves Blusseau
2013-06-15 19:55 ` SSL socks proxy list: CONNECTABLE 100% ciorapalb100

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130306094552.GA11531@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=yves.blusseau@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).