Git: fatal: Unable to create '.git/index.lock': File exists.
Git is unable to create .git/index.lock file because it already exists. Steps to reproduce using files that are readily available:
- Goto https://wordpress.org/download/ and download WordPress ZIP archive.
- Extract to a directory.
- Open Cmder and change directory where WordPress was extracted.
- Init directory using:
git init
- Configure
user.nameanduser.email
git config user.name "test"
git config user.email "[email protected]"
- Add all files.
git add -A
- Commit files.
git commit -m "test"
An error like this shows up:
fatal: Unable to create 'Z:/a/.git/index.lock': File exists.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
- Listing the
.gitdirectory shows that anindex.lockfile exists. - Open Task Manager and multiple Git for Windows processes are still running.
I also have the problem. Why close the issue ?
Because it has nothing to do with cmder, it's a git problem.
Can you tell me how to solve the problem ? Just update git ?
Yeah that would be the only thing that could help, otherwise create a ticket over at git-for-windows
thx a lot, I'd like to search about it.
Do you sure that you don't have another Cmder tab with opened the same git folder? Everything must be ok if you close another.
I have the same issue, with another command git mergetool and I think it is a cmder issue because If I do the steps inside a window prompt, there is no problem.
The problem is definitely with Cmder or ConEmu. It spawns a git process that never closes each time it displays the prompt line (so if you are in a directory which is also a git repo, on each enter press you get a new process spawned). One of those git processes produces a index.lock file which prevents any other git process to operate on the repo.
It seems to be the same issue as here: https://github.com/cmderdev/cmder/issues/1060
Same issue here. Also confirmed that if I run the same commands in a windows command prompt everything is fine. However in cmder the issue persists. The index.lock file appears when I do a 'git add .' from then on the lock file is there. Can't do a commit after that...
Same for me. It's spawning git processes which do not end leaving you with an index.lock which you cannot delete since the process is still running.
Same for me... a new git process spawns every time I enter the directory.
Same problem here. Just installed git for windows and used git bash to add,commit and push things to github. This problem is definitely with Cmder. Its sad to see such an excellent terminal has this problem 😭
I'm also having this problem, and it seems to be caused by cmder. When cmder is open, there's the index.lock file in the .git folder of my project. As soon as I close cmder, it is deleted.
A way to fix this issue for me is to close cmder and use git bash instead to push to my repo or do whatever I want to do. Once that's done, I can re-open cmder and the index.lock file will not be created, I can use cmder again for git operations.
Fixed in #1101
@MartiUK , how can I use it? I see the release version is still 1.3.1. Should I build it by myself? Is there a documentation? I'm sorry I'm new to this.
@ogrishman The latest development builds are always here: https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts
@MartiUK, Thank you!
I'm having the same issue with latest v1.3.1 of Cmder, it is still spawning multiple Git for Windows processes as soons as I cd into a local repository
EDIT: sorry, didn't see @ogrishman comment, thanks ;)
Same problem here