首页 > 解决方案 > git-askpass.exe:没有这样的文件或目录无法读取用户名

问题描述

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

试图达到的目标

将解决方案从 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 Credential Manager 的情况下重新安装。从 GitHub 存储库安装 Windows 凭据管理器。
    1. 修复 Visual Studio 2017 安装。
    2. 在凭据管理器中删除和创建登录

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

标签: gitvisual-studioazure-devops

解决方案


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

在 VS -> Team Explorer -> Manage Connections -> Connect to a project -> 检查您是否可以连接到 VSTS 帐户/域 ( https://repodomain.visualstudio.com )。

在此处输入图像描述 在此处输入图像描述

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

在 VSTS 帐户安全页面(https://repodomain.visualstudio.com/_settings/security)-> 选择您所在的组-> 检查是否允许创建新项目的权限。

在此处输入图像描述


推荐阅读