Fix: VS Code keeps asking git credentials on Windows

Elnoor Mammadli
2 min readDec 1, 2021

--

I have a git repo on Azure DevOps which I cloned to my machine via https. As prompted during the cloning process I generated git credentials and entered it.

Everything is fine so far, I have been successfully cloned my repo locally. But then when I started fetching, pulling or basically any operation that would require to talk to the origin I was prompted to enter the password every single time, which is annoying.

Which also gave me clue that the credentials are not saved anywhere at all. So, to make git store the credentials I run this command on PowerShell

git config --global credential.helper wincred

As a result global .gitconfig (found under C:\Users\User) file was created (would have been updated if it existed before, but I recently deleted it on purpose). And that looked like this:

That configuration simply tells git to globally use Windows Credential Manager to store git credentials. As a result next time I did git fetch I was prompted for password again, entered it, and that was the last time I entered it. To verify I looked through Credentials Manager and saw a new Generic Credential has been added for my Azure DevOps Organization’s URL.

Note: If you will still be prompted for password in VS code, try “git fetch” on CLI and enter password there. If still no luck try deleting the repo locally and clone again.

--

--