Search code examples
gitvisual-studioatlassian-sourcetree

Visual Studio 2017 Team Foundation Error git bash "failed to acquire credentials"


Enviroment:

  • Windows 10 Home 1709
  • Microsoft Visual Studio Enterprise 2017 Version 15.5.3
  • git version 2.16.1.windows.1

I get Team Foundation Error when "Team Explorer -> Sync"

Output (Source Control - Git) shows me

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

remote origin ssh://[email protected]/projects/project.git

I can fetch, push, pull by git CMD with password.

However, Visual Studio unable to sync, fetch, push, pull.

How can I solve this?


I also can not push or pull by Source Tree.

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.

Solution

  • I can fetch, push, pull by git CMD with password.

    That means your private SSH key has a passphrase.
    Note: you could consider using one without passphrase to avoid the ssh agent setup.

    Regarding SourceTree, check what git it is using in the settings (native or system): try the system one.
    And check Tools > Options > General > SSH Client Configuration: it should use OpenSSH.