Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
507 views
in Technique[技术] by (71.8m points)

windows - Git error: fatal: unable to connect a socket (Invalid argument)

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 losing authentication tokens on the second HTTP GET. A more recent version of libcurl might be needed.


Update January 2011: jbustamovej mentions in his answer (upvoted) his blog post "GitHub Behind Corporate Proxy", which adds this:

It’s important to note that if your login has a backslash, as in domainlogin, you must escape the backslash, as in:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...