Git 错误:致命:无法连接套接字(参数无效)

发布于 2024-07-12 11:07:43 字数 1518 浏览 5 评论 0原文

我的 MSysGit (Windows 上的 Git)在我的家用机器上运行得很好,但是在工作中,我们使用 Microsoft ISA 代理,当我执行 Git 时,出现以下错误克隆:

H:
cd \
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 环境变量设置为:

http://our-proxy-server:8088

我已设置 Git http.proxy 配置指令:

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

以上两者都没有什么区别。

使用 http:// 而不是 git:// 进行 Git 克隆会产生以下结果:

H:
cd \
git clone http://github.com/akitaonrails/vimfiles.git

Output:

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 当然是身份验证错误。

有没有办法让 Git 在代理(特别是 ISA 代理)后面工作? 我不知道这是否值得追求。

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:
cd \
git clone git://github.com/akitaonrails/vimfiles.git

Output:

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:
cd \
git clone http://github.com/akitaonrails/vimfiles.git

Output:

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.

Is there a way 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

伤痕我心 2024-07-19 11:07:43

我有完全相同的错误; 但 ~/.gitconfig 全局配置文件是关键。

如果您有带有身份验证的代理,则需要将其放入:

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

并且它可以正常工作(使用“git clone http:”)

详细说明相同设置的博客示例:GIT 通过 HTTP 克隆:谁知道?


如果仍然失败407,这可能与 git-fetch 丢失身份验证令牌的问题有关第二个 HTTP GET更新版本的 libcurl可能需要。


2011 年 1 月更新:jbustamovej他的回答(已投票) 他的博客文章“GitHub 背后的企业代理",其中添加了以下内容:

请务必注意,如果您的登录名有反斜杠,如 domain\login您必须转义反斜杠,如:

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

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 domain\login, you must escape the backslash, as in:

git config --global http.proxy http://domain\\\login:password@our-proxy-server:8088
踏雪无痕 2024-07-19 11:07:43

即使配置代理后,您也可能无法连接,因为代理不允许 Git 协议流量。 在这种情况下,您可能需要尝试使用“http”而不是“git”。

H:
cd \
git clone http://github.com/akitaonrails/vimfiles.git

此外,如果您使用自动代理配置文件 (.pac),只需在文本编辑器中打开它即可。 这是一种非常容易遵循的脚本语言,有很多条件可以重定向到最有效的代理。 找到允许通用流量的代理(通常是最后配置的代理),并按照上面的评论中所述进行配置。

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:
cd \
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 redirect 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.

再浓的妆也掩不了殇 2024-07-19 11:07:43

您有 SOCKS 代理吗? 如果有的话,您可以尝试使用 FreeCap 来袜子化您的 Git 连接。 我已经以这种方式使用 Git 一段时间了。

如果没有,仍然尝试 FreeCap。 IIRC 它也许能够使用 HTTP 代理,但我还没有尝试过。

我通常使用 FreeCap 来袜子化cmd.exe,从那时起(几乎)我从该会话启动的所有 cmdline 程序也都是袜子化的。 这就是我推荐 Free Cap 的原因,因为 SocksCap(另一种替代方案)不能以这种方式工作。

至于使用http.proxy,由于某种原因,它对我的​​ MinGW 版本和我公司的 HTTP 代理从来不起作用。

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

If not, still try FreeCap. IIRC it might be able to use HTTP proxies, but I haven't tried that.

I usually 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 the MinGW version and my company's HTTP proxies.

毅然前行 2024-07-19 11:07:43

我设法通过一条非常复杂的路线让它工作。 具体方法如下:

  1. 我在我的家用计算机(Vista 盒子)上运行 OpenSSH 在 Cygwin 下运行
  2. 我正在使用 Bitvise Tunnelier 的 通过集成 SOCKS/HTTP CONNECT 代理进行动态隧道
  3. 然后我使用 Freecap (感谢 Marko)来“SOCKify”GIT-GUI。 不幸的是,您必须单独设置每个 EXE 文件并从 Freecap 中运行它们,因此您无法普遍 SOCKify 所有 Git 命令行工具。 您可以在 Freecap 中设置显式命令行命令,但您必须单独设置每个命令,这违背了目的。 这就是为什么我刚刚在这个疯狂的复杂系统中设置 GIT-GUI

令人惊讶的是,它似乎有效,尽管我还没有测试所有内容。 当然,它会克隆,这是一个开始。

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 file individually and run them from within Freecap, so you can't universally 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.

时光病人 2024-07-19 11:07:43

这对我有用:

git config --global http.proxy http://login:password@PROXY_SERVER:PORT
git config --global http.sslVerify false

Here is what worked for me:

git config --global http.proxy http://login:password@PROXY_SERVER:PORT
git config --global http.sslVerify false
我最亲爱的 2024-07-19 11:07:43

在从 GitHub 收到 407 错误和其他垃圾后,Python 2.7 和 ntlmaps 对我有用。

文件.gitconfig

[http]
      proxy = http://127.0.0.1:5865

Python 2.7 and ntlmaps worked for me after getting 407 errors and other junk from GitHub.

File .gitconfig:

[http]
      proxy = http://127.0.0.1:5865
醉酒的小男人 2024-07-19 11:07:43

我在 Windows 7 上遇到了这个问题:

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)

我终于意识到这是 AVG AntiVirus 软件正在运行。 我禁用了AVG中的“驻留盾”,它的作用就像一个魅力。

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.

I had this problem on Windows 7:

git clone git://github.com/facebook/php-sdk.git

Output:

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)

I finally realized it was AVG AntiVirus software running. I disabled the "resident shield" within AVG, and it worked like a charm.

git clone git://github.com/facebook/php-sdk.git

Output:

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文