Reputation: 4076
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...
Upvotes: 30
Views: 69519
Reputation: 849
I had the same issue with Visual Studio 2017 + a Git repo hosted at Bitbucket.
On each Git transaction, I got the Atlassian Bitbucket login window, where I entered the correct user/pass, then got the error:
could not read Username for 'https://bitbucket.org': terminal prompts disabled
What helped for me is first manually logging into Bitbucket in Internet Explorer, and possibly closing/accepting all the notifications/popups that were waiting for me. After that, Git from VS2017 worked again.
I think they were preventing the VS Git login process to complete successfully.
Upvotes: 1
Reputation: 222
I had a similar problem.
I solved it by the following steps:
Please note that it will ask for Username Password every time you perform any of the Git operations (pull/push/fetch/clone etc).
I solved it by the following:
Run
git config --global credential.helper store
then run
git pull
provide a username and password. These details will then be remembered.
Upvotes: 2
Reputation: 2287
Updating git to latest version and running in Administrator command window helped me
Upvotes: 0
Reputation: 4544
I had the same issue and doesn't fix doing anything above and fixed by doing following,
1)go to souce code location ===> .git folder ==>config file ==> open it.
2)go to [remote "origin"] url ="dev.azure.com/xxxx/_git/yyyy" copy that url
3)open the fresh browser [icongnito :)] open the copied url.
4)It ask to login just login from your commiting credential. login and go to files and click on clone button.you see in image
6)past that URL in step 2 location.
7)I also remove C:\Users(profile)\AppData\Local\GitCredentialManager\tenant.cache file [added later] it works at least for me.
Side note : anyone know why that url prefix with site created user name instead of my user name ?
Upvotes: 0
Reputation: 3500
In my case this happened when my VS 2019 license expired. I approached helpdesk and they gave a new license and then I activated it and when I tried to Fetch using VS 2019 the problem started. I got below error message when I did Fetch in VS 2019.
Git failed with a fatal error. could not read Username for 'https://xxx.visualstudio.com': terminal prompts disabled
Below are the steps I did
1) I went to Credential Manager and deleted the entry for https://xxx.visualstudio.com.
2) Installed GIT Credential Manager for Windows. https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases
3) Open command prompt and went to my local working directory.
4) Gave command git fetch and pressed enter and I got few messages that said Fetch was success.
5) Re-opened VS 2019 and did Fetch and now it worked. I also tested Pull, Push and so on and everything works.
Upvotes: 2
Reputation: 76
I experienced same issue (with VS2017), I solved it by deleting the following Git folder
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git
After deleting it I performed some git operation and then Visual Studio asked my credentials for git then it worked fine.
Upvotes: -1
Reputation: 21
The combination of clearing credentials and deleting tenant.cache has worked for me in the past - I was able to force a reconnect to my *.visualstudio.com git repo and get things working entirely from within VS2017. Had to do more today with a new VS2019 install though. Key in my case was "terminal prompts disabled" portion of the error (similar to Anuranjan Srivastav's comment on the accepted answer). Doing a simple "git fetch" using command line tools (after clearing out credentials) did the trick for me this time - prompt for credentials came up and all was set aright.
Upvotes: 2
Reputation: 1604
Okay after much heartache I managed to resolve the issue (at this point had I tried everything including deleting accounts from Credential Manager).
I started up Visual Studio 2017 and then I opened my repository and next went to the Team Explorer tab for the repository.
I left-clicked on the Sync option and then again on the sync link button to initiate the pull/push actions. This caused Visual Studio to display a dialog box asking me to select my credentials.
However what I did to resolve the issue was to first "Forget" the account that I was trying to use in the first place (left-click on the 3 dot icon on the right) and then I was prompted for the username and password again - enter the correct one's and it should all sync up nicely now!
Upvotes: 3
Reputation: 1
You should delete credential and add with the same url new, but instead of password for credential You should use Personal Access Tokens, which you can generate git:https://xxx.visualstudio.com. -> security -> Personal Acccess Token. You can get it by select existing token andpush to regenerate.
and create new
Upvotes: 0
Reputation: 1345
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
Upvotes: 4
Reputation: 410
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
Upvotes: 20
Reputation: 517
Simply update your Visual Studio to the latest version. This bug was reported and fixed with the latest updates. Worked for me.
Upvotes: 6
Reputation: 38096
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.
Upvotes: 33