不能推git,visual studio。Git 因致命错误而失败。致命:遇到 HttpRequestException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48956927/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't push git, visual studio. Git failed with a fatal error. fatal: HttpRequestException encountered
提问by Zaldimmar
Here is my error on visual studio. I can't figure out if there is a config to fix this. Additionally I am restricted from installing git command line tools.
这是我在 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
采纳答案by Daedalon
Cause:GitHub updated their security requirements on the server side. They no longer support TLS 1.0 and 1.1, only 1.2. Older Git Credential Manager for Windows versions used 1.0.
原因:GitHub 更新了他们在服务器端的安全要求。它们不再支持 TLS 1.0 和 1.1,仅支持 1.2。适用于 Windows 版本的旧版 Git Credential Manager 使用 1.0。
Solution:Update Git for Windows. Version 2.14.3 and newer include an up-to-date Git Credential Manager for Windows.
解决方案:更新适用于 Windows 的 Git。版本 2.14.3 及更新版本包括适用于 Windows 的最新 Git 凭证管理器。
Alternatively you can update only the Git Credential Manager for Windowsitself. It supports TLS 1.2 from version 1.14.0 onwards.
或者,您可以仅更新适用于 Windows的Git Credential Manager本身。它从 1.14.0 版开始支持 TLS 1.2。
回答by Lachezar Lalov
Simply update your Visual Studio to the latest version and this should be fixed. Worked for me.
只需将您的 Visual Studio 更新到最新版本,这应该会得到修复。对我来说有效。
回答by smoore4
Git Credential Manager for Windows v1.17.1fixes the issue on BitBucket. Note the one comment:
Git Credential Manager for Windows v1.17.1修复了 BitBucket 上的问题。请注意一条评论:
Bug Fixes:
Fixes a bug related to Bitbucket authentication (thanks to @Foda for contributing the fixes).
Bug修复:
Fixes a bug related to Bitbucket authentication (thanks to @Foda for contributing the fixes).
https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases
https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases
回答by Nz_z
This is because Github disabled TLS v1.0 and v1.1,you can read the notice on Github Engineering, here is the link Weak cryptographic standards removal notice.
这是因为 Github 禁用了 TLS v1.0 和 v1.1,您可以阅读 Github Engineering 上的通知,这里是链接弱密码标准删除通知。
From the linked page:
从链接页面:
Last year we announced the deprecation of several weak cryptographic standards. Then we provided a status update toward the end of last year outlining some changes we'd made to make the transition easier for clients. We quickly approached the February 1, 2018 cutoff date we mentioned in previous posts and, as a result, pushed back our schedule by one week.
去年,我们宣布弃用几个弱加密标准。然后我们在去年年底提供了状态更新,概述了我们为使客户更容易过渡而做出的一些更改。我们很快就接近了我们在之前的帖子中提到的 2018 年 2 月 1 日的截止日期,因此将我们的日程安排推迟了一周。
...
...
Visual Studio ships with specific versions of Git for Windows and the Git Credential Manager for Windows (GCM). Microsoft has updated the latest versions of Visual Studio 2017 to work with TLSv1.2 Git servers. We advise users of Visual Studio to upgrade to the latest release by clicking on the in-product notification flag or by checking for an update directly from the IDE. Microsoft has provided additional guidance on the Visual Studio developer community support forum.
Visual Studio 附带特定版本的 Git for Windows 和 Git Credential Manager for Windows (GCM)。Microsoft 已更新最新版本的 Visual Studio 2017 以使用 TLSv1.2 Git 服务器。我们建议 Visual Studio 用户通过单击产品内通知标志或直接从 IDE 检查更新来升级到最新版本。Microsoft 在Visual Studio 开发人员社区支持论坛上提供了附加指南。
回答by tyrantqiao
In my case, updating git and copying the bin directory cannot fix the error. My solution is checking your git config.
First, open git bash.
Second, check git config. git config -l
The http.proxy and https.proxy would make you cannot update the project successfully. And if you use vpn, and make the 1080 port open, that would make the upload not so smoothly.(Only the case that your vpn is slow)
就我而言,更新 git 和复制 bin 目录无法修复错误。我的解决方案是检查您的 git 配置。首先,打开 git bash。其次,检查 git 配置。git config -l
http.proxy 和 https.proxy 会使您无法成功更新项目。如果你使用vpn,并且打开1080端口,那会使得上传不那么顺利。(只有你的vpn很慢的情况)
回答by lymber
In my case the above didn't work since my google email address for bitbucket had 2 factor authentication. So I had to create a bitbucket app token and in the origin https url I had to put the token that was generated like so https://username:[email protected]/repo/test.git
在我的情况下,上述方法不起作用,因为我的 bitbucket 谷歌电子邮件地址有 2 因素身份验证。所以我必须创建一个 bitbucket 应用程序令牌,并且在源 https url 中我必须放置像这样生成的令牌https://username:[email protected]/repo/test.git
回答by Somenath Maji
Check if you have proper configuration. It might be possible if all are okay, there is a wrong email. Inside Team explorer check Global Settings for email.
检查您的配置是否正确。如果一切正常,可能有可能是电子邮件错误。内部团队资源管理器检查电子邮件的全局设置。
回答by Daniel
You code written above is right, but if you can pull and can't push, but you can push just in console and not in VS, and you are behind a corporate proxy, then you might try another approach. It may work for you:
你上面写的代码是对的,但是如果你可以拉不能推,但你只能在控制台而不是在VS中推,而且你在公司代理后面,那么你可以尝试另一种方法。它可能对你有用:
- Create GitHub token: https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line#creating-a-token
In the
.gitconfig
file write:[credential] authority = *the-token*"
Search for the file
.gitconfig
by command:git config --list --show-origin
- 创建 GitHub 令牌:https: //help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line#creating-a-token
在
.gitconfig
文件中写:[credential] authority = *the-token*"
.gitconfig
通过命令搜索文件:git config --list --show-origin