fatal: unable to get credential storage lock: File exists

git
37,023

Solution 1

I had the same issue today. It turned out that I somehow had two configs for credential.helper. Use git config --list to check whether your have multiple credential.helper="XXX".

In my case, I had credential.helper=manager in global config and credential.helper=store in local config.

I removed the local one in path-to-git-project/.git/config and solved the problem.

Solution 2

try to configure your credential helper without using --global

git config credential.helper wincred

Solution 3

The error message comes from git credential-store (click for documentation page). It indicates that another instance of the credential storage program is currently running and has locked the file that (insecurely, in plain-text) stores your password.

If no other instance of git credential-store is actually running, the lock file is no doubt left over from a previous run, and you can simply remove it. Unfortunately the program fails to tell you the location of the specific credentials file (but see the documentation for likely locations).

Solution 4

in my case on windows there was a git credentials .lock added in my c:\users\xxxx directory where all global git config lives.

i deleted the lock file which also removed the git credentials file that stored my password in clear text

Solution 5

This is what fixed the problem for me on Window: I run git config --list --show-origin and find all credential.helper=XXX configs, then go to all directories containing those .gitconfig files and change that setting to credential.helper=store

Also, your local config should be helper = manager too: go to .git/config and add/modify this line like this:

[credential]
helper = manager
Share:
37,023

Related videos on Youtube

J. Doe
Author by

J. Doe

Updated on February 03, 2021

Comments

  • J. Doe
    J. Doe about 3 years

    I am using git-scm and tried to push to a repository. Upon doing so, I was greeted with the following message:

    fatal: unable to get credential storage lock: File exists
    

    While the push did end up pushing successfully, I was wondering why this error appeared. It is still doing this, and was not doing this before. Any help is appreciated. Thanks!

    • Mörre
      Mörre almost 8 years
      I found that there is a file /c/Users/USERNAME/.git-credentials.lock - but when I delete it I get an assertion error next time I run git, and there is a new lock file. Which leads to a new "lock: File exists" error. I also found that I had two (differing) settings for credential.store, one in my home directory, and another one in /C/Program\ Files/Git/mingw64/etc/gitconfig. Removing the latter changed nothing, even though git config -l now only shows one setting. So to me this issue remains a mystery. I found this: github.com/git-for-windows/git/issues/766
    • Joe RR
      Joe RR almost 8 years
      this happened to me after "cancel" one git add or commit. if you press CTRL+C at git bash.
  • phil
    phil almost 8 years
    For me I think this has something to do with the new credential manager stuff with the latest versions of Git for Windows. The old paradigm was to set credential.helper to store and use auth keys... now it seems Git for Windows will manage your live account internally by default
  • cst1992
    cst1992 almost 7 years
    This helped me with my 'No such file or directory' error. It was trying to interpret ~ as a folder inside the current dir.
  • Kay
    Kay almost 6 years
    OP was wondering about the cause of the error message they got, this doesn't answer their question (also we don't know if they are using Windows or another OS).
  • Oliver
    Oliver about 5 years
    This fixed my problem. I also found git config --list --show-origin to be useful, and git config --WHICH --unset credential.helper where WHICH is the offending entry location ie local, global, or system.
  • Ami
    Ami about 5 years
    On my system it was in ~/.git-credentials.lock
  • Taoufik J
    Taoufik J over 3 years
    Works like a charm :)
  • Neir0
    Neir0 over 2 years
    For windows I used process monitor
  • Neir0
    Neir0 over 2 years
    in my case .gitconfig was in user's folder
  • Vladislav Rastrusny
    Vladislav Rastrusny over 2 years
    Git 2.7.4 says 'unknown option show-origin'`