git 带有 bitbucket 的 Visual Studio 2017,禁用终端提示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51757837/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:10:24  来源:igfitidea点击:

Visual studio 2017 with bitbucket, terminal prompts disabled

gitvisual-studio-2017git-clonegit-credential-manager

提问by Gustavo Moraes

The visual studio stopped sending my commits to the bitbucket and this error appears

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: //[email protected]': terminal prompts disabled The error occurs when I try to clone my repository or commit

克隆远程存储库时遇到错误:Git 失败,出现致命错误。遇到 HttpRequestException。提交请求时出错。不能产卵

C / Program Files (x86) / Microsoft Visual Studio / 2017 / Community / Common7 / IDE / CommonExtensions / Microsoft / TeamFoundation / Team Explorer / Git / mingw32 / libexec / git-core / git-askpass.exe: 没有那个文件或目录

无法读取“https://[email protected]”的密码:终端提示已禁用当我尝试克隆我的存储库或提交时发生错误

回答by Mark Dowell

I had the same issue, I found an answer that worked for me here: https://github.com/github/VisualStudio/issues/949

我遇到了同样的问题,我在这里找到了一个对我有用的答案:https: //github.com/github/VisualStudio/issues/949

Below are the steps mentioned to fix: It seems that the bundled Git-Credential-Manager-for-Windows/ in VIsual Studio 2017 is not the latest release. Downloading the latest release and putting it on top of the files in Visual Studio 2017 worked for me.

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

  1. download the zip file gcmw-v1.17.0.zipfrom https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.0
  2. navigate to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\(or wherever your 'missing' git-askpass.exeresides).
  3. make a copy of the git-core folder and rename it backup or something like that
  4. put the files from the zip file on top of the contents of your new git-core folder and overwrite where prompted
  1. https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.0下载zip 文件 gcmw-v1.17.0.zip
  2. 导航到C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\(或“失踪”git-askpass.exe所在的任何地方)。
  3. 复制 git-core 文件夹并将其重命名为备份或类似的名称
  4. 将 zip 文件中的文件放在新 git-core 文件夹的内容之上,并在出现提示的地方覆盖

回答by Ecd

I have added my password to remote URL. (Team Explorer > Repository Settings > Remotes) https://username:[email protected]/username/myproject.git. After that my problem has solved.

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

回答by jessehouwing

A better solution.

更好的解决方案。

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.

在与 Chad Boles(在 Visual Studio 中维护团队资源管理器)交谈后,我们找到了另一个选择。这比覆盖 Visual Studio 安装中的文件更可取,因为这可能会破坏未来的更新,并可能导致未来难以调试的问题。

The trick is, until Visual Studio actually ships with Git credential Manager for Windows 1.18.4 or newer (it should after Visual Studio 2019 preview 4.0 or newer), to configure the specific installation location of the Git credential manager in your Git Global Config:

诀窍是,在 Visual Studio 实际附带适用于 Windows 1.18.4 或更高版本的 Git 凭据管理器(它应该在 Visual Studio 2019 预览版 4.0 或更高版本之后)之前,在 Git 全局配置中配置 Git 凭据管理器的特定安装位置:

  1. Install the latest version of GCMW-1.xx.x.exein your system and/or update to the latest version of Git for Windowswhich should include GCM.
  2. Update your global git config to point to a specific implementation of the Git credential Manager:

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

    Update the [credential]section to read:

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

    Ensure the path points to where the latest Git Credential Manager can be found on your system. Mind all of the escapes needed to make paths work in the global git config.

  1. 在您的系统中安装最新版本的 GCMW-1.xx.x.exe和/或更新到最新版本的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 Credential Manager 的位置。注意使路径在全局 git 配置中工作所需的所有转义。

An alternative that doesn't require config changes

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

Another option is to install the latest version of Git for Windows (which already ships with the Git credential Manager for Windows 1.18.4) and perform the initial clone and authentication from the command line. This will store the credentials in the Windows Credential Store, after which Visual Studio will happily pick them up.

另一种选择是安装适用于 Windows 的最新版本的 Git(它已随适用于 Windows 1.18.4 的 Git 凭据管理器一起提供)并从命令行执行初始克隆和身份验证。这会将凭据存储在 Windows Credential Store 中,之后 Visual Studio 会很高兴地获取它们。

回答by S-eagle

I just solved this same issue for myself in Visual Studio 2019.

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

In Tools -> Nuget Package Manager -> Package Manager Console

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

This command will update the GitForWindows version (as well as the Git Credentials manager) for you.

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

Install-Package GitForWindows -Version 2.23.0

Install-Package GitForWindows -Version 2.23.0

Reference: https://www.nuget.org/packages/GitForWindows/

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

回答by ricsierics

In addition to Ecd'sanswer (can't comment yet), when your password contains '@' sign (or any symbols used in url), you need to escape that character as it will result to 'Could not resolve host' by url encoding. %40for the case of '@' sign.

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

回答by Joebet Mutia

I just experienced it this instant. so what i did is i tried to login to bitbucket, surpisingly it says "I cant login to using username please use email". then i did login using my email,then dig my bitbucket settings and found out that i can generate a password..

我刚刚经历了这一刻。所以我所做的是我尝试登录到 bitbucket,令人惊讶的是它说“我无法使用用户名登录,请使用电子邮件”。然后我确实使用我的电子邮件登录,然后挖掘我的 bitbucket 设置并发现我可以生成密码..

  1. Goto settings
  2. App password
  3. Create app password
  4. use the password to login instead of your real password
  1. 前往设置
  2. 应用密码
  3. 创建应用密码
  4. 使用密码登录而不是您的真实密码

enter image description here

在此处输入图片说明