I've been struggling with that issue for a couple days now.
I'm unable to connect to my Git project (stored in VisualStudio.com) from a specific computer (it works on my second PC). Whenever I try to Sync or Clone my repository, VS2017 asks for my user credentials (twice) and the I get the following error :
Error: cannot spawn askpass: No such file or directory Error encountered while cloning the remote repository: Git failed with a fatal error. could not read Username for 'https://.visualstudio.com': terminal prompts disabled
Can't remember if I changed anything that could've caused that...
Simply update your Visual Studio to the latest version. This bug was reported and fixed with the latest updates. Worked for me.
I had a similar problem.
Push from within VS2017 would fail, I was getting an error spawning git-askpass.exe
I fixed it by copying/replacing all the files in the VS2017 git-core folder with the files from the git-core folder created by the Git installation.
I might have only needed the new git-credential-manager.exe, but I replaced everything.
So far, no problems.
VS2017 folder: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\git-core
Git installation folder: C:\Program Files\Git\mingw64\libexec\git-core
It’s mainly caused by the credentials have been remembered by Credential Manager. You should remove the credentials for xxx.visualstudio.com which have been stored in Credential Manager.
Such as if the pc’s OS is windows, you can open Credential Manager -> Windows Credentials -> under Generic Credentials -> remove the credentials like git:https://xxx.visualstudio.com.
Then clone again, git will let you input the credential for the repo. After inputing the username(email address) and password which can access the VSTS account, the repo should be cloned successful.
I did not have any git credentials registered with Windows Credentials and I still received this error, even after selecting my windows user account in the VS User Dialog popup.
After a day of trying different things like re-installing GIT for windows, I managed to fix this issue by deleting a this file: "C:\Users(profile)\AppData\Local\GitCredentialManager\tenant.cache".
On the next retry, a GIT entry showed up in my Windows Credentials generic list. See Issue