问题描述
我的 msysGit(Windows 上的 Git)在我的家用机器上运行得很好,但在工作中,我们在 Microsoft ISA 代理后面,当我执行 git clone 时,我收到以下错误:
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)
我尝试将 http_proxy 环境变量设置为:
I've tried setting the http_proxy environment variable to:
http://our-proxy-server:8088
我已经设置了 git http.proxy 配置指令:
I've set the git http.proxy configuration directive:
git config --global http.proxy http://our-proxy-server:8088
以上都没有区别.
使用 http://
而不是 git://
执行 git clone 会产生以下结果:
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 当然是身份验证错误.
407 is of course an authentication error.
所以我的问题是:有没有人设法让 git 从代理(特别是 ISA 代理)后面工作?我不知道这是否值得追求.非常感谢任何帮助.
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.
谢谢!
推荐答案
我遇到了完全相同的错误;但是 ~/.gitconfig
全局配置文件 是关键.
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
它只是工作(使用'git clone http:
')
And it just works (with 'git clone http:
')
详细说明相同设置的博客示例:通过 HTTP 进行 GIT 克隆:谁知道?
Example of a blog detailing the same setup: GIT clone over HTTP: who knew?
如果在 407 仍然失败,则可能与 git-fetch 在第二个 HTTP GET 上丢失身份验证令牌.最新版本的 libcurl 可能需要.
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.
2011 年 1 月更新:jbustamovej 在 他的回答(已投票) 他的博客文章GitHub 背后的企业代理",其中补充道:
Update January 2011: jbustamovej mentions in his answer (upvoted) his blog post "GitHub Behind Corporate Proxy", which adds this:
请务必注意,如果您的登录名带有反斜杠,如在 domainlogin
中,您必须转义反斜杠,如:
git config --global http.proxy http://domain\login:password@our-proxy-server:8088
这篇关于Git 错误:致命:无法连接套接字(无效参数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!