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
execute C:\Program Files\Git\mingw64\libexec\git-core>git-credential-manager.exe remove
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
try to configure your credential helper without using --global
git config credential.helper wincred
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.
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
.