【问题标题】:fatal: unable to access <link> getaddrinfo() thread failed to start致命:无法访问 <link> getaddrinfo() 线程无法启动
【发布时间】:2022-03-10 15:33:10
【问题描述】:

当我输入时:git push origin master

错误:

fatal: unable to access 'https://github.com/<github-username>/<repository-name>.git/': getaddrinfo() thread failed to start

我该怎么办?

【问题讨论】:

  • 启动一个新终端并输入git config --global --unset-all https.proxy,然后重试。
  • 我们说的是在 Windows 上使用 Git,是吗?
  • 是的,我们说的是在windows上使用git
  • 建议的方法无效。所以我创建了一个新的 Github 帐户,添加了 SSH 密钥,现在它运行良好。尽管任何关于前一个的线索都会受到赞赏。

标签: git git-for-windows


【解决方案1】:

我遇到了同样的问题,我尝试了几种解决方案,直到我发现在我的情况下是防火墙。我的是“免费防火墙”,我注意到即使授权软件和连接,仍然无法连接到远程存储库。我禁用了它并没有解决它,只有当我卸载它时问题得到解决并且我能够正常使用Git。

【讨论】:

  • 感谢您将我指向防火墙 - 我正在使用 Windows Defender 防火墙,并且我的机器在域上的设置方式经常导致我出现与防火墙相关的问题。在这种情况下(和许多其他情况下)重新启动 Windows Defender 防火墙完全解决了问题。
  • 当我在 Windows 中使用 Windows Defender 防火墙服务的启动类型时遇到了这个问题。我发现如果防火墙配置为手动启动,它会重现这个问题。如果配置为自动启动,问题就消失了。这个启动值可以通过注册表调整(不能通过 services.msc 配置)。
【解决方案2】:

我的机器上出现同样的问题(git 版本 2.28.0.windows.1)。 该问题似乎与 HTTP 请求的 DNS 解析有关:

这是我原来的远程网址:

git remote set-url origin http://<FQDN>:<http_port>/<repository>.git

与问题中的结果相同:

$ git pull
fatal: unable to access 'http://<FQDN>:<http_port>/<repository>.git/': getaddrinfo() thread failed to start

将 URL 更改为解析的 IP 时:

$ ahost <FQDN>
<FQDN>                               <IP>

$ git remote set-url origin http://<IP>:<http_port>/<repository>.git

Git 连接没有问题:

$ git pull
Already up to date.

此外,当使用 SSH 而不是 HTTP 时,分辨率没有问题:

$ git remote set-url origin ssh://<username>@<FQDN>:<ssh_port>/<repository>.git
$ git pull
Already up to date.

Curl 在我的 MINGW64 环境中也不起作用:

$ ahost www.google.com
www.google.com                          172.217.2.100
    
$ adig www.google.com
id: 64322
flags: qr rd ra
opcode: QUERY
rcode: NOERROR
Questions:
        www.google.com .                A
Answers:
        www.google.com .        49      A       172.217.2.100
NS records:
Additional records:


$ curl www.google.com -v
* getaddrinfo() thread failed to start

* Couldn't resolve host 'www.google.com'
* Closing connection 0
curl: (6) getaddrinfo() thread failed to start

【讨论】:

    【解决方案3】:

    如果您在系统中安装了任何防病毒或防火墙,请关闭 git 访问或完全卸载并重新启动。我遇到了同样的问题并卸载了防火墙。它工作得很好。

    【讨论】:

    • 欢迎来到 Stack Overflow。这个答案添加了什么不在接受的答案中?
    • 如果您使用防火墙,请允许 git 程序。
    【解决方案4】:
    fatal: unable to access <link> getaddrinfo() thread failed to start
    

    这个错误表明你的电脑防火墙不允许进行这种操作 所以只需从您的系统和防病毒软件中禁用它并正常使用您的 git。 希望它对你有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-10
      • 2011-04-28
      • 2023-01-23
      • 2019-03-16
      • 2016-08-12
      • 1970-01-01
      • 2017-09-06
      相关资源
      最近更新 更多