fatal: unable to get credential storage lock: File exists
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
Related videos on Youtube
J. Doe
Updated on February 03, 2021Comments
-
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 almost 8 yearsI 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 forcredential.store
, one in my home directory, and another one in/C/Program\ Files/Git/mingw64/etc/gitconfig
. Removing the latter changed nothing, even thoughgit 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 almost 8 yearsthis happened to me after "cancel" one git add or commit. if you press CTRL+C at git bash.
-
-
phil almost 8 yearsFor 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 almost 7 yearsThis helped me with my 'No such file or directory' error. It was trying to interpret
~
as a folder inside the current dir. -
Kay almost 6 yearsOP 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 about 5 yearsThis fixed my problem. I also found
git config --list --show-origin
to be useful, andgit config --WHICH --unset credential.helper
where WHICH is the offending entry location ielocal
,global
, orsystem
. -
Ami about 5 yearsOn my system it was in
~/.git-credentials.lock
-
Taoufik J over 3 yearsWorks like a charm :)
-
Neir0 over 2 yearsFor windows I used process monitor
-
Neir0 over 2 yearsin my case .gitconfig was in user's folder
-
Vladislav Rastrusny over 2 yearsGit 2.7.4 says
'unknown option
show-origin'`