Visual studio 未知错误的扩展 - 无法推送或获取任何内容

Extension for Visual studio unknown error - unable to push or fetch anything

当我尝试通过 visual studio 的 Git 扩展将任何内容推送到我的 bitbucket 存储库时出现错误:

Error encountered while pushing branch to the remote repository: Git failed with a fatal error.
HttpRequestException encountered.
   An error occurred while sending the request.
cannot spawn /C/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/mingw32/libexec/git-core/git-askpass.exe: No such file or directory
could not read Password for ......

这可能是什么问题?

它似乎影响了一些 Visual Studio 用户 since a few hours ago,即使在此之前环境没有发生任何变化。 Git 与 Visual Studio 的集成显然出了点问题。

目前有一个解决方法,您可以在存储库的远程设置中设置密码,如图 here,但请注意,它 不安全 因为它需要以纯文本形式存储密码。

另一种解决方法是使用命令行使用 Git。

第三种解决方法,也是我发现最好的一种,是配置 SSH 密钥身份验证。截至目前,它似乎可以毫无问题地与 Visual Studio 2017 一起使用。这是我选择的方案。

我将此报告为一个错误,因为它是在我更新到 15.7.6 后才开始发生的。

https://developercommunity.visualstudio.com/content/problem/307355/vs-2017-git-failed-with-a-fatal-error-after-instal.html

目前,我只是在 'git clone url' 上设置通行证,这解决了我的问题。

https://login:pass@bitbucket.org/myrepo/myproject.git

不过,我仍在寻找更好的解决方案。

原因: 几个月前 GitHub 弃用了对 TLS1.0 和 TLS1.1 的支持时出现了同样的错误消息。现在,Atlassian 似乎在 2018 年 8 月 6 日 (https://blog.bitbucket.org/2018/08/06/update-ip-migration/) 对 BitBucket 的网络进行了一些更改。此更改可能与问题有关。

解决方法: Visual Studio 2017 中捆绑的 Git-Credential-Manager-for-Windows 还不是最新版本.下载最新版本并将其放在 Visual Studio 2017 中的文件之上解决问题:

  1. https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases
  2. 下载 zip 文件 gcmw-v1.16.3.zip
  3. 导航到 C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\(或您的 'missing' git-askpass.exe 所在的位置)
  4. 备份 git-core 文件夹
  5. 将 zip 文件中的文件放在新 git-core 文件夹内容的顶部,并在提示的位置覆盖

如果已配置(即更改 https://login@bitbucket.org/myrepo/myproject.git to https://bitbucket.org/myrepo/myproject.git),您似乎还需要从远程设置中删除 "login",并改用带有完整电子邮件的 Atlassian ID。

(source)

1) 在凭据管理器中删除凭据

2) 在"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git"

中重命名或删除Git目录

3) 安装包“https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.0

4) 当 VS 要求 BitBucket / GitHub 凭证时插入它们

我遇到了同样的问题。 visual studio 尝试登录 GitHub 时出现错误。
获取 windows 的 Git :
https://git-scm.com/download/win

这将为 windows 安装 git bash 和 GUI。
打开gitbash
转到现有的 repo 并尝试执行 pull(>>git pull) 或者,尝试执行 git clone (>>git clone someurl
这将触发并在 Web 浏览器中请求 git 凭据。
只需输入凭据并登录
如果登录成功,请尝试从 visual studio 拉取。它应该可以正常工作。