Git is unable to create .git/index.lock file because it already exists. Steps to reproduce using files that are readily available:
git init
user.name and user.emailgit config user.name "test"
git config user.email "[email protected]"
git add -A
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.
.git directory shows that an index.lock file exists.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
rm .git/index.lock
@daxgames it is not a solution, bundled git.exe always create new index.lock and prevents commiting. Solved in the latest build though
it's locked,you can use GUI to unlock it and then everything will be fine, i just tried it
@WillJE Why should anyone have to unlock it? Something within the application keeps causing it to lock. Manually unlocking it gets you by one time, but this is a recurring issue. Your saying we should have to manually go in and unlock it every time it glitches out? That is not a solution, it's called a band-aid fix.
For anyone ran into the same issue with index lock, there's a workaround that disabling
Settings -> Git Extensions -> Performance -> Show number of changed files on commit button
so that Git Extensions won't call git status as soon as any file updates which blocking the current processing git commands and introducing the lock.
Hope this help for you guys.
Might get a real fix soon https://github.com/git-for-windows/msys2-runtime/commit/78e2deea8ec1db4aea1e78432ae98dac7198f6a5
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.
the above solution worked for me thanks
@AnilKumar345
this solution work thanks
Thought it worked at first, but once cmder is open and I go on my repo, the git starts up and an empty index.lock pops up. If I kill the git instance with the task manager, and then delete the file, it works.
Just sharing in case someone else has the same issue.
Though there is an alternative above, but that didn't solve my situation.
In my case, I delete the "git" plugin in ./zshrc and reboot the computer then the issue is gone, I guess the plugin had done something conflict the git command.
solution : rm -Force ./.git/index.lock
If you are getting the same error then please follow the below steps.
goto .git in the folder location
delete the index.lock file
now check everything will work
Hey! If you guys are using MAC osx, try this solution :
remove the old file wich probaly has some crushed process git ->
rm /Users/mac/some_other_dic/project/.git/index.lock
Then, after initialize the new one->
git init
@lucas0000miranda how does this have anything to do with cmder if you are on mac osx given cmder is a Windows only app?
@daxgames hmmm not sure. I just put that in context make sure that this implementation will work for MAC users.
@daxgames and also this is a issue in index.lock file on GIT in general. Not just for cmder.
I am facing same issue saying /index.lock with "another git process seems to be running.. " on my command line Git Bash terminal
the above solution worked for me thanks
How u done ..........................where i have to open local repositary
@AnilKumar345
this solution work thanks
Most helpful comment
Problem:
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.
Solution: