【问题标题】:git-askpass.exe: No such file or directory could not read Username forgit-askpass.exe:没有这样的文件或目录无法读取用户名
【发布时间】:2018-07-10 14:23:40
【问题描述】:

我想我已经对这个问题进行了相当多的研究,但我还没有找到相应的问题/解决方案。

想要达到的目标

从 VS 2017 发布解决方案并将其推送到 Microsoft Visual Studio Team Services (VSTS)。

可重现的例子

已创建带有项目“ExampleProject”的新解决方案“GitExample”(/w“创建新的 Git 存储库”已选中)。

在 Team Explorer 窗口中,我选择“Push to Visual Studio Team Services”部分下的“Publish Git Repo”。我选择我的帐户和域,然后按“发布存储库”。

从 Git 打印以下错误消息。

Opening repositories:
c:\users\SampleUser\source\repos\PythonApplication4
Commit e3b04515 created locally in repository c:\users\SampleUser\source\repos\PythonApplication4
Error encountered while pushing branch to the remote repository: Git failed with a fatal error.
ArgumentNullException encountered.
   Value cannot be null.
Parameter name: path
ArgumentNullException encountered.
   Value cannot be null.
Parameter name: path
cannot spawn /C/Program Files/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/mingw32/libexec/git-core/git-askpass.exe: No such file or directory
could not read Username for 'https://repodomain.visualstudio.com': terminal prompts disabled
Pushing to https://repodomain.visualstudio.com/_git/PythonApplication4

A new Git repository has been created for you in C:\Users\SampleUser\source\repos\GitExample.
Opening repositories:
C:\Users\SampleUser\source\repos\GitExample
Commit 5d8765b7 created locally in repository C:\Users\SampleUser\source\repos\GitExample
Opening repositories:
C:\Users\SampleUser\source\repos\GitExample
The calling thread cannot access this object because a different thread owns it.
Error encountered while pushing branch to the remote repository: Git failed with a fatal error.
ArgumentNullException encountered.
   Value cannot be null.
Parameter name: path
ArgumentNullException encountered.
   Value cannot be null.
Parameter name: path
cannot spawn /C/Program Files/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/mingw32/libexec/git-core/git-askpass.exe: No such file or directory
could not read Username for 'https://repodomain.visualstudio.com': terminal prompts disabled
Pushing to https://repodomain.visualstudio.com/_git/GitExample

问题似乎在于Git Credential Manager for Windows。但是,Windows 凭据管理器正确列出了 git:repodomain.visualstudio.com 以及正确的用户名和密码组合。

做了什么:

  1. 卸载 git for Windows 并在没有 Windows 凭据管理器的情况下重新安装。从 GitHub 存储库安装 Windows 凭据管理器。
    1. 修复 Visual Studio 2017 安装。
    2. 在凭据管理器中删除和创建登录

感谢您为此付出的时间和精力。

【问题讨论】:

    标签: git visual-studio azure-devops


    【解决方案1】:

    通过团队资源管理器中的管理连接检查您的电子邮件地址与 VSTS 帐户的连接。详细步骤如下:

    在 VS -> 团队资源管理器 -> 管理连接 -> 连接到项目 -> 检查您是否可以连接到 VSTS 帐户/域 (https://repodomain.visualstudio.com)。

    另外,请检查您是否有权在VSTS帐户https://repodomain.visualstudio.com中创建新项目。检查权限的步骤如下:

    在VSTS账号安全页面(https://repodomain.visualstudio.com/_settings/security)->选择你所在的组->查看是否允许创建新项目。

    【讨论】:

    • 刘丽娜您好,感谢您的支持。您在检查与 VSTS 的连接以及未发现问题根源的权限方面的提示。但是,我确实设法解决了这个问题。我还没有发布答案,因为我不确定哪一步解决了这个问题。这是我所做的:卸载所有版本的 GIT(也是 VS17 提供的版本)。在没有“Git for Windows”的情况下修改 VS17 安装。从网站安装“Git for Windows”。使用命令行 git 克隆 repo。认证。现在所有 git 功能都可以在 VS17 中使用了。
    【解决方案2】:

    我在 Visual Studio 2019 中遇到错误:

    cannot spawn /c/program files (x86)/microsoft visual studio/2019/enterprise/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw32/libexec/git-core/git-askpass.exe
    

    在我的情况下,解决方案是不同的。问题是 Visual Studio 2019 附带的内置 git 未正确处理两步身份验证。

    解决办法:

    -First make sure you close all visual studio instances.
    -Delete all generic credentials in windows credential manager related to git, devops, azure, SSO_POP_Device, virtualapp/didlogical, etc
    -Delete the GitCredentialManager\\tenant.cache in the %appdata% folder
    -Bring up the default web browser and open your repository.  In my case, I just had to open up the following site:
    
    https://dev.azure.com/myDevOpsSite
    

    这样,系统会提示您输入用户名/密码,然后在您的手机上进行两步验证。在此之后,凭据被正确存储,您现在可以打开 Visual Studio 并从 Visual Studio 中推送/拉取,而不会出现错误。

    【讨论】:

      【解决方案3】:

      我通过重置 Git 代理解决了 VS2019 中的这个错误: 关闭VS。 以管理员身份运行 CMD 并执行此 cmd: git config --global http.proxy http://proxy:8080 启动VS

      【讨论】:

        猜你喜欢
        • 2014-08-24
        • 2014-05-08
        • 2021-11-24
        • 2016-11-12
        • 2021-09-10
        • 2019-10-15
        • 1970-01-01
        • 2017-08-27
        • 1970-01-01
        相关资源
        最近更新 更多