fatal: unable to get credential storage lock: File exists
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!
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.
try to configure your credential helper without using --global
git config credential.helper wincred
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).
I've had a hard time figuring out where the lock file was.
On Linux, just use strace
, but don't forget to follow child processes with the -f
option:
strace -f -eopen git credential-store --file=~/mystore store < creds
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/dev/null", O_RDWR) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
open("/home/g179531/.gitconfig", O_RDONLY) = 3
Process 8269 attached
[pid 8269] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 8269] open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
[pid 8269] open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
[pid 8269] open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
[pid 8269] open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 8269] open("~/mystore.lock", O_RDWR|O_CREAT|O_EXCL, 0666) = -1 ENOENT (No such file or directory)
fatal: unable to get credential storage lock: No such file or directory
[pid 8269] +++ exited with 128 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8269, si_status=128, si_utime=0, si_stime=0} ---
+++ exited with 128 ++
The last file that the program tried to open before printing the error is the lock file. In my case, it's ~/mystore.lock
.
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