views:

7975

answers:

6

I've got msysGit (Git on Windows) working just fine on my home machine, but at work, where we are behind a Microsoft ISA proxy, I get the following error when I do a git clone:

H:\>git clone git://github.com/akitaonrails/vimfiles.git
Initialized empty Git repository in H:/vimfiles/.git/
github.com[0: 65.74.177.129]: errno=Invalid argument
fatal: unable to connect a socket (Invalid argument)

I've tried setting the http_proxy environment variable to:

http://our-proxy-server:8088

I've set the git http.proxy configuration directive:

git config --global http.proxy http://our-proxy-server:8088

Neither of the above makes a difference.

Doing a git clone with http:// instead of git:// yields this:

H:\>git clone http://github.com/akitaonrails/vimfiles.git
Initialized empty Git repository in H:/vimfiles/.git/
fatal: http://github.com/akitaonrails/vimfiles.git/info/refs download error - The    requested URL returned error: 407

407 is of course an authentication error.

So my question is: has anyone managed to get git working from behind a proxy, specifically an ISA proxy? I don't know if it's going to be worth pursing this. Any help very much appreciated.

Thanks!

+3  A: 

Do you have SOCKS proxy? If you have, you caould try FreeCap to socksify your git connection. I've been using git this way for a while.

If not, still try FreeCap, if IIRC it might be able to use http proxies, but didn't tried that.

EDIT: I usualy socksify cmd.exe using FreeCap, and from then on (almost) all cmdline programs that I start from that session are socksified too. That's why I recommended Free Cap, since SocksCap (another alternative) doesn't work that way.

As for using http.proxy, it for some reason never worked for me with mingw version and my company http proxies.

Dev er dev
Thanks for this, FreeCap looks interesting. Are you able to elaborate on how you're using Git with it?
Charles Roper
+10  A: 

I had the exact same error; but the ~/.gitconfig global config file was the key.

If you have a proxy with authentication you need to put in it:

git config --global http.proxy http://login:password@our-proxy-server:8088

And it just works (with 'git clone http:')

Example of a blog detailing the same setup: GIT clone over HTTP: who knew?


If it still fails in 407, it could be related to a problem with git-fetch loosing authentication tokens on the second HTTP GET. A more recent version of libcurl might be needed.

VonC
Thanks for the tip, but I can't get this working. It still gives me a 407 (authentication) error even though I've set the proxy (complete with username and password) in both the environment and .gitconfig.
Charles Roper
I just tried this again, since msysGit has been updated, and it worked. Hurrah! I guess libcurl must have been updated in the latest version.
Charles Roper
+1  A: 

I've managed to get it working via a very convoluted route. Here's how:

  1. I have OpenSSH running on my home machine (a Vista box) running under Cygwin
  2. I am using Bitvise Tunnelier's Dynamic tunneling via integrated SOCKS/HTTP CONNECT proxy.
  3. I then use Freecap (thanks Marko) to "SOCKify" GIT-GUI. Unfortunately, you have to setup each .exe individually and run them from within Freecap, so you can't univerally SOCKify all of the git command line tools. You can setup explicit command-line commands within Freecap, but you have to setup each individually, which kind of defeats the purpose. This is why I've just setup GIT-GUI in this crazy elaborate system

Amazingly, it seems to work, although I've not tested everything yet. It'll clone, certainly, which is a start.

If anyone has a better solution, I'm all ears.

Charles Roper
+3  A: 

Even after configuring the proxy, you might be unable to connect, since the proxy is disallowing git protocol traffic. In this case, you might want to try using "http" instead of "git"

H:>git clone http://github.com/akitaonrails/vimfiles.git

Also, if you are using an automated proxy config file (.pac), just open it in a text editor. It is quite a easy to following scripting language, with a bunch of conditions to re-direct to the most efficient proxy. Find the one that allows general purpose traffic (typically, the last configured proxy), and configure it as mentioned in the comment above.

shiva
Great! i had a similar problem with git, it was giving this error "Unable to connect to socket (no error)". I configured my --global http.proxy and i used http instead of git when cloning, and it worked.
gath
A: 

Hi could anyone explain how to "socksify" cmd.exe under Freecap. I tried running it and then it simply exit.

John Rogers
A: 

I had this problem on windows7:

$ git clone git://github.com/facebook/php-sdk.git Initialized empty Git repository in c:/Users/Jay/temp/php-sdk/.git/ github.com[0: 207.97.227.239]: errno=No error fatal: unable to connect a socket (No error)

Finally realized it was AVG anti virus software running. I disabled the "resident shield" within AVG and works like a charm now.

$ git clone git://github.com/facebook/php-sdk.git Initialized empty Git repository in c:/Users/Jay/temp2/php-sdk/.git/ remote: Counting objects: 223, done. remote: Compressing objects: 100% (179/179), done. emote: Total 223 (delta 84), reused 0 (delta 0) Receiving objects: 100% (223/223), 37.32 KiB, done. Resolving deltas: 100% (84/84), done.

Jay