5

I'm relatively new to git. I've been working on projects, pushing to and pulling from my GitHub repos. After I set everything up, all I needed to do was type git push origin main in the bash terminal and everything worked.

Earlier today, I wanted to push to a remote repo on GitHub. I typed git pull origin main exactly as I have a hundred times, but suddenly I get the error "fatal: Unable to persist credentials with the 'wincredman' credential store."

I've tried everything I could find. I unset my credential manager, deleted old credentials in Windows Credential Manager, tried creating a PAT. I finally managed to successfully pull/push using the PAT, but now I have to manually input my username and PAT every single time.

I have no idea what happened, but I would love to be able to push/pull from remote without needing to login.

torek
  • 448,244
  • 59
  • 642
  • 775
BardYoren
  • 71
  • 1
  • 4
  • The error message here (`fatal: Unable to persist credentials with the 'wincredman' credential store.`) points to a problem with the credential manager your Git software is using. If it's still using that even with no manager set, that must be the default for your particular Git distribution. I don't use Windows, but [the GCM docs](https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/configuration.md) say that this is the default for (most?) Windows setups. – torek Jun 21 '22 at 19:12
  • Why wincredman is failing, I have no idea, but people who've used GCM (see link above) seem to like it. Meanwhile if you like wincredman you should investigate as to why it's failing. – torek Jun 21 '22 at 19:13
  • By the way, [this question](https://stackoverflow.com/q/72700709/1256452) refers to a problem when using remote access via PowerShell. That could be related. – torek Jun 21 '22 at 20:49
  • Try restarting your machine. Fixed the same "Unable to persist credentials with the 'wincredman' credential store." error for me. – bbodenmiller Jan 11 '23 at 09:26

4 Answers4

17

The same issue happened to me when I push file from visual studio to github. When you will get Unable to persist credentials with the 'wincredman' credential store this type of error. Just type this command on command prompt

git config --global credential.credentialStore dpapi and after that type git push command . It works for me.

Priyanka Jadhav
  • 181
  • 1
  • 3
2

Honestly not really sure what I did to fix things. I deleted all of the credentials set in git/Windows Credential Manager/etc... Tried to pull from remote in VS Code and it made me log in to GitHub. Now everything is back to working as expected. It seems like I can only push/pull from VS Code the way that I want. I guess it works.

BardYoren
  • 71
  • 1
  • 4
1

The same issue happened to me when I was trying to pull any incoming on the master branch using the Git Repository window in Visual Studio Professional 2022 (64-bit) Version 17.4.2.

Here is how I fixed it:

  1. Delete the existing git credential in Windows Credential Manager
    1. Type "Credential Manager" in Windows search bar
    2. Select "Windows Credentials"
    3. You should see a list of Generic Credentials
    4. If you see one that starts with "git:https://dev.azure.com/{your_organization}", expand it by clicking the down arrow, and click "Remove"
  2. Close any Visual Studio you have opened
  3. Right click Visual Studio and do "Run as administrator"
  4. Now when you try to do a Pull again, it should prompt you the login screen
  5. After successfully logging in, a git credential should be recorded in Windows Credential Manager
David Liang
  • 20,385
  • 6
  • 44
  • 70
0

I had this problem.

I followed the above advice David Liang and BardYolen gave on this post along with some additional stack overflows post and none of it worked.

I eventually had to launch visual studios installer. Modify my versions individual to include GitFor windows by going to individual components and checking the box next to "git for windows". Then, I updated my visual studios.

After that everything seemed to work.

I am unsure if I had git for windows in visual studios before that and it just got deleted somehow or if I never had it and something got updated to removed my access to used git without it.

brandon s
  • 71
  • 5