【问题标题】:Visual Studio 2017 Team Foundation Error git bash "failed to acquire credentials"Visual Studio 2017 Team Foundation 错误 git bash“无法获取凭据”
【发布时间】:2018-01-24 04:46:28
【问题描述】:

环境:

  • Windows 10 家庭版 1709
  • Microsoft Visual Studio Enterprise 2017 版本 15.5.3
  • git 版本 2.16.1.windows.1

“团队资源管理器 -> 同步”时出现 Team Foundation 错误

输出(源代码控制 - Git)向我展示了

Opening repositories:
C:\Users\user\Documents\Projects\project
Git failed with a fatal error.
failed to acquire credentials.
failed to acquire credentials.
failed to acquire credentials.
From ssh://developer.whereprojectis.com/projects/project
 = [up to date]      master     -> origin/master
 * [new branch]      Version1.5 -> origin/Version1.5
 * [new branch]      gov        -> origin/gov
 * [new branch]      ver1.6.0   -> origin/ver1.6.0

远程原点 ssh://git@developer.whereprojectis.com/projects/project.git

我可以通过带有密码的 git CMD 获取、推送、拉取。

但是,Visual Studio 无法同步、获取、推送、拉取。

我该如何解决这个问题?


我也不能通过源树推拉。

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
Error reading SSH_ASKPASS output for prompt: Password:
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

【问题讨论】:

    标签: git visual-studio atlassian-sourcetree


    【解决方案1】:

    我可以通过带有密码的 git CMD 获取、推送、拉取。

    这意味着您的 SSH 私钥有密码。
    注意:您可以考虑使用一个没有密码来避免设置 ssh 代理。

    关于 SourceTree,检查它在设置中使用的 git(本机或系统):尝试系统之一。
    并检查Tools > Options > General > SSH Client Configuration:它应该使用 OpenSSH。

    【讨论】:

    • 我将 SourceTree 的 SSH 客户端配置更改为 OpenSSH。但是它失败了,因为 OpenSSH 代理正在运行,但服务器仍然拒绝您的连接。 我猜服务器管理器可以设置 SSH 密钥...但是我可以在 git CMD 中使用密码仍然是个谜。
    • @ibocon 这就是为什么我建议不要使用密码:您需要使用 ppk Putty SSH 密钥:community.atlassian.com/t5/Sourcetree-questions/…
    【解决方案2】:

    在我的情况下,答案相当简单:Visual Studio 从来没有要求我输入密码,因为 ssh 客户端还不知道服务器的主机密钥/指纹。 在这种情况下,当您第一次通过 ssh 推/拉时,您会收到相应的消息并提示您是否要接受密钥。 不幸的是,VisualStudio 2019 并不关心它然后卡住了,因为 git 因为不接受 servert 主机密钥而取消了请求。

    在命令提示符下首先拉取该 git 服务器上的第一个 repo 并手动接受那里的密钥为我解决了这个问题。从那时起工作正常。

    【讨论】:

      猜你喜欢
      • 2017-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-25
      • 2011-02-01
      • 1970-01-01
      • 2019-01-20
      相关资源
      最近更新 更多