Visual studio 2017 年使用 bitbucket,禁用终端提示

Visual studio 2017 with bitbucket, terminal prompts disabled

visual studio 停止将我的提交发送到 bitbucket 并出现此错误

Error encountered while cloning the remote repository: Git failed with a fatal error. HttpRequestException encountered. There was an error submitting the request. can not 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 'https: //gustavobedsamarpes@bitbucket.org': terminal prompts disabled The error occurs when I try to clone my repository or commit

我遇到了同样的问题,我在这里找到了适合我的答案: https://github.com/github/VisualStudio/issues/949

以下是提到的修复步骤: VIsual Studio 2017 中捆绑的 Git-Credential-Manager-for-Windows/ 似乎不是最新版本。下载最新版本并将其放在 Visual Studio 2017 年的文件之上对我有用。

  1. https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.0
  2. 下载 zip 文件 gcmw-v1.17.0.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 文件夹并将其重命名为 backup 或类似名称
  5. 将 zip 文件中的文件放在新 git-core 文件夹内容的顶部,并在提示的位置覆盖

我已将我的密码添加到远程 URL。 (团队资源管理器 > 存储库设置 > 远程)https://username:password@bitbucket.org/username/myproject.git。 之后我的问题就解决了。

我刚刚在这一瞬间体验到了。所以我所做的是我尝试登录到 bitbucket,令人惊讶的是它说 "I cant login to using username please use email"。然后我使用我的电子邮件登录,然后挖掘我的 bitbucket 设置,发现我可以生成密码..

  1. 转到设置
  2. 应用密码
  3. 创建应用密码
  4. 使用密码登录而不是您的真实密码

除了Ecd的回答(还不能评论),当你的密码包含'@'符号(或任何符号在 url 中使用),您需要对该字符进行转义,因为它将导致“无法通过 url 编码解析主机 ”。 %40 对于 '@' 符号的情况。

更好的解决方案。

After chatting with Chad Boles (who maintains Team Explorer in Visual Studio), we worked out another option. This is preferred over overwriting the files in the Visual Studio installation as this may break future updates and can cause hard to debug issues in the future.

诀窍是,直到 Visual Studio 实际附带 Git Windows 1.18.4 或更新版本的凭据管理器(它应该在 Visual Studio 2019 预览版 4.0 或更新版本之后), 在你的 Git 全局配置中配置 Git 凭证管理器的具体安装位置:

  1. Install the latest version of GCMW-1.xx.x.exe in your system and/or update to the latest version of Git for Windows 应该包括 GCM。
  2. 更新您的全局 git 配置以指向 Git 凭据管理器的特定实现:

    c:\>git config --global --edit
    

    [credential] 部分更新为:

    [credential]
        helper = C:\\Program\ Files\\Git\\mingw64\\libexec\\git-core\\git-credential-manager.exe
    

    确保路径指向可以在您的系统上找到最新的 Git 凭据管理器的位置。请注意使路径在全局 git 配置中工作所需的所有转义。

不需要更改配置的替代方案

另一种选择是为 Windows 安装最新版本的 Git(它已经与 Windows 1.18.4 的 Git 凭据管理器一起提供)并执行从命令行进行初始克隆和身份验证。这会将凭据存储在 Windows 凭据存储中,之后 Visual Studio 会愉快地提取它们。

我刚刚在 Visual Studio 2019 年为自己解决了同样的问题。

在工具 -> Nuget 包管理器 -> 包管理器控制台

此命令将为您更新 GitForWindows 版本(以及 Git 凭据管理器)。

Install-Package GitForWindows -Version 2.23.0

参考: https://www.nuget.org/packages/GitForWindows/