Git does not remember username and password on Windows

Git does not remember username and password…!

I was having issues, where Git would not remember my credentials for some repositories on Windows. Usually, the repositories are stored on AzureDevops and use Windows Authentication as default, with PAT (Personal Access Token) as a fallback.

In this case, since I am not an employee in the company, I was given a PAT. But git kept asking me to enter credentials for every operation against the repository origin and it was making me crazy that it was not remembering my credentials.

Make sure that you are using Windows Credentials manager

If you are using Git on Windows, you should store your credentials in the Windows Credentials manager, so they are properly encrypted and protected.

You can check this by running the following command in CMD or Powershell:

git config --list

It will then list all settings for git. You are looking for the credential.helper which should be equal to manager, eg. credential.helper=manager.


credential.helper=manageré Snede Kock

Set credential helper

If it is not set, or you want to make sure it is. Run the following command to set the config on a global level.

git config --global credential.helper manager

And if you want a complete sanity check, you can unset it first via:

git config --global --unset credential.helper

Manually set the credentials in the Windows Credential Manager

Go to the Windows Credential manager, either by searching for it in Start:

Windows Credentials search in start
Find credential manager via Search in the Start menu

Or finding it via the Control Panel -> Manage Windows Credentials.

Go to Windows Credentials -> Generic Credentials.

Here your credential should be listed if everything is working correctly. Git should add it by default the first time you log in to a new repository. But sometimes it doesn’t work.

Luckily for us, we can add our credential manually.

Check if your git repository credential is not already listed

A correct listing for github will look like the following:

Windows Credentials - List git repository credentials
Windows Credential Manager – Correct Github credentials

Note that the internet or network address includes a git: statement, this is important!

If you have an incorrect listing, remove it before continuing.

Manually add credential

In the Generic credentials listing, click “Add a generic credential”. This will take you to a new page, where you enter a url, username and password.

Windows Credentials - Manually add git repository credentials, when Git does not remember username and password
Manually add generic credential

Make sure you remember to add “git:” to the start of the url.

That’s it! Now git should use these credentials by default.

You can now run

git pull


git clone

To test if it works. Depending on whether you have already downloaded the repo before.

Now git should remember your username and password, for that repository anyways.

Git does not automatically remember username and password, when the repository is using Windows Credentials for some reason.


If the username is already added and the above approach is not working, or not available to you, you can use the “run command” and open the key manager this way. This window is usually used for handling passwords in an automated way.

Windows Key + R – To Get the “Run” window up.

Then enter

rundll32.exe keymgr.dll,KRShowKeyMgr

This will allow you to edit, save or delete .NET Usernames and passwords. [Microsoft link]

// André Snede Kock


You may also like...

4 Responses

  1. Junko says:

    Everything is very open with a clear explanation of the challenges.

    It was reallly informative. Your website is extremely helpful.

    Thanks for sharing!

  2. Reyansh Baragwanath says:

    Excellent post. Very helpful !

    Thank you and best of luck.

  3. Symon says:

    I have just forwarded this onto a colleague who had some trouble with this.
    And he in fact ordered me breakfast because I stumbled upon it for him…
    lol. So allow me to reword this…. Thanks for the meal!!
    But yeah, thanks for spending time to share this !

  4. Matti says:

    This really was of great help!

Leave a Reply

Your email address will not be published. Required fields are marked *