【问题标题】:Can't push git, visual studio. Git failed with a fatal error. fatal: HttpRequestException encountered无法推送 git,Visual Studio。 Git 因致命错误而失败。致命:遇到 HttpRequestException
【发布时间】:2018-02-23 22:09:11
【问题描述】:

这是我在 Visual Studio 上的错误。 我不知道是否有解决此问题的配置。 此外,我被限制安装 git 命令行工具。

Error encountered while pushing to the remote repository: Git failed with a fatal error.
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
error: cannot spawn askpass: No such file or directory
fatal: could not read Username for 'https://github.com': terminal prompts disabled

【问题讨论】:

  • 这不是那个问题的重复。 Daedalon 是正确的; GitHub 删除 pre-TLS 1.2 导致了这个问题。
  • 我建议将接受的答案更改为 Lachezar 的答案,原因在 Suamere 对当前(2018 年 3 月 2 日)接受的答案的评论中提到。

标签: git visual-studio-2017


【解决方案1】:

原因: GitHub updated their security requirements on the server side。它们不再支持 TLS 1.0 和 1.1,只支持 1.2。用于 Windows 的旧版 Git Credential Manager 使用 1.0。

解决方案:更新Git for Windows。 2.14.3 及更高版本包括适用于 Windows 的最新 Git 凭据管理器。

您也可以只更新Git Credential Manager for Windows 本身。它从 1.14.0 版本开始支持 TLS 1.2。

【讨论】:

  • 这是很好的信息,但既然你应该更新 VS,Lachezar 的回答对我来说效果更好。更新 VS 确实解决了您所说的所有问题,而无需手动处理我的系统。
  • VS Update 帮我搞定了
  • @daedalon 我今天安装了 VS enterprise 2017,它显示为最新的。但是仍然在尝试克隆 VSTS git repo 时,我收到“Git 致命错误。HttpRequestException。无法生成..”。您能对此提出建议吗?
  • 嗨@RohitGarg,听起来这可能是一个不同的错误。如果您的错误消息与原始问题中的错误消息相同,请仔细检查您是否拥有最新版本的 VS。如果你这样做了,你可以考虑单独更新 Git for Windows 或 Git Credential Manager。
  • 对我来说,它通过复制两个 dll 文件得到修复,即libeay32.dll 和 ssleay32.dll 从 \Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin\" 文件夹到 "\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\ Team Explorer\Git\mingw32\libexec\git-core\" 文件夹
【解决方案2】:

只需将您的 Visual Studio 更新到最新版本即可解决此问题。为我工作。

【讨论】:

  • 谢谢拉切萨。具体来说,VS 2017 版本 15.5.7(发布 2/20/18)提到了这个修复:“我们已经更新了 Git 和 Git Credential Manager 组件”
  • 谢谢,完美运行。这应该是公认的答案。
  • 我先尝试了这个答案,但必须更新 Git for Windows 才能再次工作。
  • 我有 v15.7.6 并且仍然有这个问题。我也更新了适用于 Windows 的 Git 和凭据管理器。还是和 OP 一样的错误。
  • 感谢您的提示!为我工作。还有一个等待更新的 Windows,之后我更新了 Visual Studio
【解决方案3】:

Git Credential Manager for Windows v1.17.1 修复了 BitBucket 上的问题。注意一条评论:

错误修复:

Fixes a bug related to Bitbucket authentication (thanks to @Foda for contributing the fixes).

https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases

【讨论】:

    【解决方案4】:

    这是因为 Github 禁用了 TLS v1.0 和 v1.1,你可以阅读 Github Engineering 上的通知,这里是链接Weak cryptographic standards removal notice

    来自链接页面:

    去年,我们宣布弃用几个弱加密标准。然后,我们在去年底提供了状态更新,概述了我们为使客户更容易过渡而进行的一些更改。我们很快就接近了我们在之前的帖子中提到的 2018 年 2 月 1 日的截止日期,因此将我们的时间表推迟了一周。

    ...

    Visual Studio 附带特定版本的 Git for Windows 和 Git Credential Manager for Windows (GCM)。 Microsoft 已更新最新版本的 Visual Studio 2017 以使用 TLSv1.2 Git 服务器。我们建议 Visual Studio 的用户通过单击产品内通知标志或直接从 IDE 检查更新来升级到最新版本。 Microsoft 提供了有关Visual Studio developer community support forum 的更多指导。

    【讨论】:

      【解决方案5】:

      检查您的配置是否正确。如果一切正常,则可能有错误的电子邮件。 在团队资源管理器中检查电子邮件的全局设置。

      【讨论】:

      • Git 因致命错误而失败。无法读取“test.visualstudio.com”的用户名:终端提示已禁用
      【解决方案6】:

      在我的情况下,更新 git 和复制 bin 目录无法修复错误。我的解决方案是检查您的 git 配置。 首先,打开 git bash。 其次,检查 git 配置。 git config -l http.proxy 和 https.proxy 会使您无法成功更新项目。如果你使用vpn,并且打开1080端口,那会导致上传不那么顺利。(只有你的vpn慢的情况下)

      【讨论】:

        【解决方案7】:

        在我的情况下,上述方法不起作用,因为我用于 bitbucket 的谷歌电子邮件地址具有 2 因素身份验证。所以我必须创建一个 bitbucket 应用程序令牌,并且在源 https url 中我必须将生成的令牌像这样https://username:appToken@bitbucket.org/repo/test.git

        【讨论】:

          【解决方案8】:

          你上面写的代码是对的,但是如果你可以拉,不能推,但你只能在控制台而不是 VS 中推,而且你在公司代理后面,那么你可以尝试另一种方法。它可能对你有用:

          1. 创建 GitHub 令牌:https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line#creating-a-token
          2. .gitconfig文件中写入:

            [credential] 
            authority = *the-token*"
            
          3. 通过命令搜索文件.gitconfiggit config --list --show-origin

          【讨论】:

            【解决方案9】:

            即使在弹出窗口中输入密码后,Windows 上的Git bash 也会出现问题。 我试过Git Gui,效果很好。

            【讨论】:

              【解决方案10】:

              打开您的项目文件夹路径,右键单击该文件夹,选择 Git Bash,在其中键入命令

              git config --global http.sslVerify false

              git command

              然后尝试同步,抓取和拉取,它会工作

              【讨论】:

              • 这不是一个可行的解决方案,您将 http.sslVerify 全局设置为 false,这会危及安全。
              猜你喜欢
              • 2017-07-28
              • 2023-03-26
              • 2019-01-21
              • 1970-01-01
              • 2020-01-29
              • 1970-01-01
              • 1970-01-01
              • 2018-08-07
              相关资源
              最近更新 更多