{"thread":{"id":"33083","subject":"Using socks proxy with git for http(s) transport","startedAt":"2013-03-06T08:12:30Z","lastAt":"2013-06-15T19:55:59Z","messageCount":8,"participants":["Yves Blusseau","Jeff King","Daniel Stenberg","ciorapalb100"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"210675","messageId":"CABmRxH1g2BR+-MvGZ4J-2vC8NDq3x8pG148hXfuYTpUkX0L=0A@mail.gmail.com","threadId":"33083","inReplyTo":null,"subject":"Using socks proxy with git for http(s) transport","fromName":"Yves Blusseau","fromEmail":"yves.blusseau@gmail.com","sentAt":"2013-03-06T08:12:30Z","receivedAt":"2013-03-06T08:12:30Z","isPatch":false,"sender":{"key":"yves.blusseau@gmail.com","avatar":null},"body":"Hi all,\n\ni have a socks proxy to access internet.\nI successed in configuring git (with GIT_PROXY_COMMAND) to use the\nsocks proxy for GIT transport protocol.\nBut how to use this socks proxy with git for HTTP(S) transport protocol ?\n\nBest Regards,\nYves\n"},{"id":"210676","messageId":"20130306082110.GA31638@sigill.intra.peff.net","threadId":"33083","inReplyTo":"CABmRxH1g2BR+-MvGZ4J-2vC8NDq3x8pG148hXfuYTpUkX0L=0A@mail.gmail.com","subject":"Re: Using socks proxy with git for http(s) transport","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-03-06T08:21:16Z","receivedAt":"2013-03-06T08:21:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 06, 2013 at 09:12:30AM +0100, Yves Blusseau wrote:\n\n> i have a socks proxy to access internet.\n> I successed in configuring git (with GIT_PROXY_COMMAND) to use the\n> socks proxy for GIT transport protocol.\n> But how to use this socks proxy with git for HTTP(S) transport protocol ?\n\nTry:\n\n  git config --global http.proxy 'socks://yourhost:port'\n\nThat will enable it for all git repositories on your machine. Git should\nalso respect any environment variables that curl handles (because we use\nlibcurl under the hood), if you prefer to set it up that way. See \"man\ncurl\" for details.\n\n-Peff\n"},{"id":"210681","messageId":"CABmRxH2CGTxFaGufSMgUqhrSTZPvFBHoEnP8-p5HhkU4kszJPw@mail.gmail.com","threadId":"33083","inReplyTo":"20130306082110.GA31638@sigill.intra.peff.net","subject":"Re: Using socks proxy with git for http(s) transport","fromName":"Yves Blusseau","fromEmail":"yves.blusseau@gmail.com","sentAt":"2013-03-06T09:21:42Z","receivedAt":"2013-03-06T09:21:42Z","isPatch":false,"sender":{"key":"yves.blusseau@gmail.com","avatar":null},"body":"> Try:\n>\n>   git config --global http.proxy 'socks://yourhost:port'\n>\n> That will enable it for all git repositories on your machine. Git should\n> also respect any environment variables that curl handles (because we use\n> libcurl under the hood), if you prefer to set it up that way. See \"man\n> curl\" for details.\n\nThanks Jeff but it's not working.\nI use git 1.8.15\nMy socks proxy listen on my localhost at port 1080 so I do:\ngit config --global http.proxy  'socks://127.0.0.1:1080'\n\nBut when i try to talk with a git server with http protocol i have:\n\nGIT_TRACE=1 GIT_CURL_VERBOSE=1 git ls-remote\nhttp://git.kernel.org/pub/scm/git/git.git\n\ntrace: built-in: git 'ls-remote' 'http://git.kernel.org/pub/scm/git/git.git'\ntrace: run_command: 'git-remote-http'\n'http://git.kernel.org/pub/scm/git/git.git'\n'http://git.kernel.org/pub/scm/git/git.git'\n* Couldn't find host git.kernel.org in the .netrc file, using defaults\n* About to connect() to proxy 127.0.0.1 port 1080\n*   Trying 127.0.0.1... * connected\n* Connected to 127.0.0.1 (127.0.0.1) port 1080\n> GET http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\nUser-Agent: git/1.8.1.5\nHost: git.kernel.org\nAccept: */*\nAccept-Encoding: gzip\nProxy-Connection: Keep-Alive\nPragma: no-cache\n\n* Empty reply from server\n* Connection #0 to host 127.0.0.1 left intact\nerror: Empty reply from server while accessing\nhttp://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack\nfatal: HTTP request failed\n\nAs you can see git connect to my socks proxy (Connected to 127.0.0.1\n(127.0.0.1) port 1080) but seems to send the http request directly\ninstead of a socks command. So it does'nt work :(\n\nRegards,\nYves\n"},{"id":"210682","messageId":"CABmRxH1=wjXXLDTCAO2Ge9YcBJq4yJQd4-NUs9P=qKWzh8kkjw@mail.gmail.com","threadId":"33083","inReplyTo":"20130306082110.GA31638@sigill.intra.peff.net","subject":"Re: Using socks proxy with git for http(s) transport","fromName":"Yves Blusseau","fromEmail":"yves.blusseau@gmail.com","sentAt":"2013-03-06T09:35:58Z","receivedAt":"2013-03-06T09:35:58Z","isPatch":false,"sender":{"key":"yves.blusseau@gmail.com","avatar":null},"body":"2013/3/6 Jeff King <peff@peff.net>:\n> Try:\n>\n>   git config --global http.proxy 'socks://yourhost:port'\n>\n> That will enable it for all git repositories on your machine. Git should\n> also respect any environment variables that curl handles (because we use\n> libcurl under the hood), if you prefer to set it up that way. See \"man\n> curl\" for details.\n>\n> -Peff\n\nAlso try setting ALL_PROXY environment variable that curl handle:\nexport ALL_PROXY='socks5://127.0.0.1:1080'\n\nWork with curl:\ncurl -v http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack\n\n* About to connect() to proxy 127.0.0.1 port 1080 (#0)\n*   Trying 127.0.0.1...\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n  0     0    0     0    0     0      0      0 --:--:-- --:--:--\n--:--:--     0* 198\n* 145\n* 20\n* 140\n* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#0)\n> GET /pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\n> User-Agent: curl/7.29.1-DEV\n> Host: git.kernel.org\n> Accept: */*\n>\n< HTTP/1.1 200 OK\n< Server: nginx\n< Date: Wed, 06 Mar 2013 09:33:05 GMT\n< Content-Type: application/x-git-upload-pack-advertisement\n< Transfer-Encoding: chunked\n< Connection: keep-alive\n< Expires: Fri, 01 Jan 1980 00:00:00 GMT\n< Pragma: no-cache\n< Cache-Control: no-cache, max-age=0, must-revalidate\n<\n{ [data not shown]\n\n\nBut with git (without the http.proxy configuration in .gitconfig):\n\nGIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone\nhttp://git.kernel.org/pub/scm/git/git.git\ntrace: built-in: git 'clone' 'http://git.kernel.org/pub/scm/git/git.git'\nCloning into 'git'...\ntrace: run_command: 'git-remote-http' 'origin'\n'http://git.kernel.org/pub/scm/git/git.git'\n* Couldn't find host git.kernel.org in the .netrc file, using defaults\n* About to connect() to proxy 127.0.0.1 port 1080\n*   Trying 127.0.0.1... * connected\n* Connected to 127.0.0.1 (127.0.0.1) port 1080\n> GET http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\nUser-Agent: git/1.8.1.5\nHost: git.kernel.org\nAccept: */*\nAccept-Encoding: gzip\nProxy-Connection: Keep-Alive\nPragma: no-cache\n\n* Empty reply from server\n* Connection #0 to host 127.0.0.1 left intact\nerror: Empty reply from server while accessing\nhttp://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack\nfatal: HTTP request failed\n\nRegards,\nYves\n"},{"id":"210683","messageId":"20130306094552.GA11531@sigill.intra.peff.net","threadId":"33083","inReplyTo":"CABmRxH2CGTxFaGufSMgUqhrSTZPvFBHoEnP8-p5HhkU4kszJPw@mail.gmail.com","subject":"Re: Using socks proxy with git for http(s) transport","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-03-06T09:45:53Z","receivedAt":"2013-03-06T09:45:53Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 06, 2013 at 10:21:42AM +0100, Yves Blusseau wrote:\n\n> > Try:\n> >\n> >   git config --global http.proxy 'socks://yourhost:port'\n> >\n> > That will enable it for all git repositories on your machine. Git should\n> > also respect any environment variables that curl handles (because we use\n> > libcurl under the hood), if you prefer to set it up that way. See \"man\n> > curl\" for details.\n> \n> Thanks Jeff but it's not working.\n\nHmm. I just double-checked, and it works for me.\n\n> I use git 1.8.15\n\nI assume you mean 1.8.1.5 here.\n\n> My socks proxy listen on my localhost at port 1080 so I do:\n> git config --global http.proxy  'socks://127.0.0.1:1080'\n\nThat looks right to me.\n\n> But when i try to talk with a git server with http protocol i have:\n> [...]\n> * About to connect() to proxy 127.0.0.1 port 1080\n> *   Trying 127.0.0.1... * connected\n> * Connected to 127.0.0.1 (127.0.0.1) port 1080\n> > GET http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\n> [...]\n> * Empty reply from server\n\nIf I set up a simple socks proxy with ssh, like:\n\n  ssh -v -D 1080 my-ssh-host\n\nand run the same command, I get:\n\n  * About to connect() to proxy localhost port 1080 (#0)\n  *   Trying 127.0.0.1...\n  * SOCKS4 request granted.\n  * Connected to localhost (127.0.0.1) port 1080 (#0)\n  > GET /pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\n  [...]\n  < HTTP/1.1 200 OK\n\nand it works. It does look like curl is treating localhost:1080 as a\nregular http proxy. What version of libcurl do you have? Is there\nanything in your environment that might be causing it to override the\nconfigured proxy setting (e.g., an http_proxy or https_proxy environment\nvariable)?\n\n> As you can see git connect to my socks proxy (Connected to 127.0.0.1\n> (127.0.0.1) port 1080) but seems to send the http request directly\n> instead of a socks command. So it does'nt work :(\n\nYeah, that definitely looks like the problem.\n\n-Peff\n"},{"id":"210684","messageId":"CABmRxH25y9bAdZWV_3MG7x2LNGNDQbLB_EJC1xAJC396nO7bYQ@mail.gmail.com","threadId":"33083","inReplyTo":"20130306094552.GA11531@sigill.intra.peff.net","subject":"Re: Using socks proxy with git for http(s) transport","fromName":"Yves Blusseau","fromEmail":"yves.blusseau@gmail.com","sentAt":"2013-03-06T10:09:47Z","receivedAt":"2013-03-06T10:09:47Z","isPatch":false,"sender":{"key":"yves.blusseau@gmail.com","avatar":null},"body":"2013/3/6 Jeff King <peff@peff.net>:\n> On Wed, Mar 06, 2013 at 10:21:42AM +0100, Yves Blusseau wrote:\n>\n>> > Try:\n>> >\n>> >   git config --global http.proxy 'socks://yourhost:port'\n>> >\n>> > That will enable it for all git repositories on your machine. Git should\n>> > also respect any environment variables that curl handles (because we use\n>> > libcurl under the hood), if you prefer to set it up that way. See \"man\n>> > curl\" for details.\n>>\n>> Thanks Jeff but it's not working.\n>\n> Hmm. I just double-checked, and it works for me.\n>\n>> I use git 1.8.15\n>\n> I assume you mean 1.8.1.5 here.\n\nYes it's 1.8.15 sorry for the mistake\n\n>\n>> My socks proxy listen on my localhost at port 1080 so I do:\n>> git config --global http.proxy  'socks://127.0.0.1:1080'\n>\n> That looks right to me.\n>\n>> But when i try to talk with a git server with http protocol i have:\n>> [...]\n>> * About to connect() to proxy 127.0.0.1 port 1080\n>> *   Trying 127.0.0.1... * connected\n>> * Connected to 127.0.0.1 (127.0.0.1) port 1080\n>> > GET http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\n>> [...]\n>> * Empty reply from server\n>\n> If I set up a simple socks proxy with ssh, like:\n>\n>   ssh -v -D 1080 my-ssh-host\n\nMy socks proxy is also a socks proxy with ssh\n\n>\n> and run the same command, I get:\n>\n>   * About to connect() to proxy localhost port 1080 (#0)\n>   *   Trying 127.0.0.1...\n>   * SOCKS4 request granted.\n>   * Connected to localhost (127.0.0.1) port 1080 (#0)\n>   > GET /pub/scm/git/git.git/info/refs?service=git-upload-pack HTTP/1.1\n>   [...]\n>   < HTTP/1.1 200 OK\n\nYou have a (#0) in the log that i have when using curl directly with\nthe socks proxy\n>\n> and it works. It does look like curl is treating localhost:1080 as a\n> regular http proxy. What version of libcurl do you have? Is there\n> anything in your environment that might be causing it to override the\n> configured proxy setting (e.g., an http_proxy or https_proxy environment\n> variable)?\nI have try with an old version of curl: 7.15.5 and with the latest in\ndevelopment curl 7.29.1-DEV.\nBut it seem that git-remote-http is compile with the old one.\n\nI have no http/proxy environment variables\n"},{"id":"210686","messageId":"alpine.DEB.2.00.1303061137290.12579@tvnag.unkk.fr","threadId":"33083","inReplyTo":"CABmRxH25y9bAdZWV_3MG7x2LNGNDQbLB_EJC1xAJC396nO7bYQ@mail.gmail.com","subject":"Re: Using socks proxy with git for http(s) transport","fromName":"Daniel Stenberg","fromEmail":"daniel@haxx.se","sentAt":"2013-03-06T10:39:37Z","receivedAt":"2013-03-06T10:39:37Z","isPatch":false,"sender":{"key":"daniel@haxx.se","avatar":"https://gravatar.com/avatar/69fdca87edd17cee21ca2e79fc2ff671d644603c3dc27167430f3cd3dbab7ba8?d=mp&s=160"},"body":"On Wed, 6 Mar 2013, Yves Blusseau wrote:\n\n> I have try with an old version of curl: 7.15.5 and with the latest in \n> development curl 7.29.1-DEV. But it seem that git-remote-http is compile \n> with the old one.\n\nlibcurl 7.15.5 is over 6 years old.\n\nThe support for \"socks[*]://\" prefixes in proxy names was added to libcurl \n7.21.7 (June 23 2011).\n\n-- \n\n  / daniel.haxx.se\n"},{"id":"220959","messageId":"1371326159783-7589492.post@n2.nabble.com","threadId":"33083","inReplyTo":"CABmRxH1g2BR+-MvGZ4J-2vC8NDq3x8pG148hXfuYTpUkX0L=0A@mail.gmail.com","subject":"Re: SSL socks proxy list: CONNECTABLE 100%","fromName":"ciorapalb100","fromEmail":"ciorapalb100@gmail.com","sentAt":"2013-06-15T19:55:59Z","receivedAt":"2013-06-15T19:55:59Z","isPatch":false,"sender":{"key":"ciorapalb100@gmail.com","avatar":null},"body":"24.21.139.76:9855\n173.57.153.187:62189\n96.43.245.75:26101\n24.107.48.229:8169\n75.136.147.231:4351\n\n\nSSL socks proxy list: CONNECTABLE 100%\n\n\nMore socks at: http://actualproxy.biz/\n\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/Using-socks-proxy-with-git-for-http-s-transport-tp7579041p7589492.html\nSent from the git mailing list archive at Nabble.com.\n"}]}