Created a PAT, but git keeps sending a password

I normally use TortoiseGit for GitHub access (using Windows10). Today, after getting messages about passwords no longer being accepted, I created a wincred PAT, cleared the saved authentication data cache from TortoiseGit, then tried to do a push. But GitHub complains that git is still trying to send a password. I’m not really familiar with the git command line commands. I’ve been reading the docs for quite a while now, but not getting anywhere. I installed the latest git version. My global .gitconfig file has these entries:

[credential “”]
helper = wincred
username = eygilbert

Can someone help me get git to start using the PAT instead of a password? Thanks.

Having a similar issue

I’m watching this thread, feel free to watch mine in case I get a solution from someone. I did get some advice but it did not solve it for me.

Good luck!

It seems that my password is cached somewhere and git is sending it automatically. I need to delete this, so that I can get it to prompt for credentials and input the PAT that I have created. But I cannot find where the password is cached. I’ve looked in the Windows Credentials Manager but there are no entries there for git. I don’t see a password cached in any of the .git config files. I’m really stuck. How can I purge this cached password? When I installed git I also installed Git Credential Manager Core. Is it possibly cached there? I don’t know to how I can tell.

Yes, that’s indeed the case.

Possibly, if you have enabled Git to use that instead of its default credentials tool.

A good file to check is .git-credentials in your User folder (talking about Windows here: C:\Users\YourUsername\), and also in the .ssh/ subfolder therein, in case you’re using SSH with Git.

If not, you’ll have to query your Git configuration to check which credentials manager it’s using, and where it might be storing them:

1 Like

Tajmone, thanks. I don’t find a .git-credentials file anywhere.
I have this entry in .gitconfig

helper = manager-core

I queried the gcm-core version:

d:\projects>git credential-manager-core --version

After reading the docs about gcm-core, it looks like I need to send the erase command, although I’m not sure, it’s not at all clear to me what I should do. Anyway, I tried this:

d:\projects>git credential-manager-core erase

But it still has the password cached. Can you tell me what the commands should be to erase the password?

The docs for gcm-core say this about the commands get / store / erase:

“Commands for interaction with Git. You shouldn’t need to run these manually.” Which makes me think I’m looking in the wrong place.

On your device type in credential manager on windows search anf launch app. Select the correct tab and delete the entry referring to git.
Next time you perform a Git command that requires authentication you will be prompted to enter credential

1 Like

Thank you byrneh. I have looked at all the Windows credentials listed in Credential Manager, and none of them are anything related to git.

@eygilbert are you using git command line or Tortoise Git?
If using git command line that is installed with git-scm install. It will will only use the Git credential manager specified in you git config for caching, you can even disable the use of crendential manager if you so choose.
If you type git version you should see something like git version returned.
To see in detail you local git configuration type
git config --list --show-origin --show-scope

I don’t use Tortoise Git but I am told this suggestion may work.
Go to your TortoiseGit settings for your repository, then go to the local .git/config… It should open in Notepad.
After that, edit the URL to the repository, in the format of github username:access_token@rest/of/the/url.git

are you using git command line or Tortoise Git?

I normally use TortoiseGit, but since my problem seems to be with the underlying command-line git, I have been working with that to try to solve the problem. Installing TortoiseGit requires that I also install the command-line git.

If you type git version you should see something like git version returned.

d:\projects>git version
git version

d:\projects>git config --list --show-origin
file:C:/Program Files/Git/etc/gitconfig credential.helper=manager-core
file:C:/Program Files/Git/etc/gitconfig diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean – %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge – %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process
file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:C:/Program Files/Git/etc/gitconfig core.autocrlf=input
file:C:/Program Files/Git/etc/gitconfig core.fscache=true
file:C:/Program Files/Git/etc/gitconfig core.symlinks=false
file:C:/Program Files/Git/etc/gitconfig core.editor=notepad
file:C:/Program Files/Git/etc/gitconfig pull.rebase=false
file:C:/Program Files/Git/etc/gitconfig credential.
file:C:/Program Files/Git/etc/gitconfig init.defaultbranch=master
file:c:/Users/family/Documents/.gitconfig Gilbert
file:c:/Users/family/Documents/.gitconfig credential.
file:c:/Users/family/Documents/.gitconfig credential.
file:c:/Users/family/Documents/.gitconfig gui.recentrepo=D:/Projects/Git/GuiCheckers

After that, edit the URL to the repository, in the format of github username:access_token@rest/of/the/url.git

Here is the entry from the config file of one of my repos:

[remote "origin"]
	url =
	fetch = +refs/heads/*:refs/remotes/origin/*

It’s not in the format that you gave. I’m not sure how to proceed from there. Should I simply replace my username with username:access_token in the line below?

url =

Ah, I misunderstood your suggestion. I edited the config file to look like this:

url =

and now I am able to push to this repos. Thanks for the help!

I finally found the root cause of my problem. The github username and password were cached in a _netrc file in my Documents directory. What’s really insidious is that none of the git commands seemed to be able to either display or delete this cache. With this problem fixed, git is now using the PAT stored in Windows Credential manager, and I don’t have to edit the remote origin url in every config file of every local repository to make authentication work.


Excellent! Mark your solution as the Solution, so other users can quickly find it and benefit from it.

Thanks, it’s that. However I have two entries for Github… Grrr

Hi @Naheulf! Nice to see you here on the Community Forum! (I’ve just labeled your PR for the French docs, thanks!)