cmder icon indicating copy to clipboard operation
cmder copied to clipboard

Git: fatal: Unable to create '.git/index.lock': File exists.

Open Sabrethan opened this issue 10 years ago • 41 comments

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.name and user.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 .git directory shows that an index.lock file exists.
  • Open Task Manager and multiple Git for Windows processes are still running.

Sabrethan avatar Jul 18 '16 19:07 Sabrethan

I also have the problem. Why close the issue ?

phith0n avatar Jul 31 '16 15:07 phith0n

Because it has nothing to do with cmder, it's a git problem.

Stanzilla avatar Jul 31 '16 17:07 Stanzilla

Can you tell me how to solve the problem ? Just update git ?

phith0n avatar Jul 31 '16 18:07 phith0n

Yeah that would be the only thing that could help, otherwise create a ticket over at git-for-windows

Stanzilla avatar Jul 31 '16 18:07 Stanzilla

thx a lot, I'd like to search about it.

phith0n avatar Jul 31 '16 18:07 phith0n

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.

acrap avatar Aug 02 '16 14:08 acrap

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.

r1z1 avatar Sep 05 '16 07:09 r1z1

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.

ghola avatar Sep 06 '16 21:09 ghola

It seems to be the same issue as here: https://github.com/cmderdev/cmder/issues/1060

ghola avatar Sep 06 '16 21:09 ghola

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...

cringerjs avatar Sep 18 '16 01:09 cringerjs

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.

stefan-wiesner avatar Sep 21 '16 07:09 stefan-wiesner

Same for me... a new git process spawns every time I enter the directory.

oskarlind avatar Sep 27 '16 07:09 oskarlind

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 😭

nerzid avatar Sep 27 '16 14:09 nerzid

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.

Demers94 avatar Sep 27 '16 20:09 Demers94

Fixed in #1101

MartiUK avatar Sep 27 '16 21:09 MartiUK

@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 avatar Oct 17 '16 15:10 ogrishman

@ogrishman The latest development builds are always here: https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts

MartiUK avatar Oct 17 '16 15:10 MartiUK

@MartiUK, Thank you!

ogrishman avatar Oct 17 '16 15:10 ogrishman

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 ;)

ClementParis016 avatar Oct 23 '16 17:10 ClementParis016

Same problem here

selrond avatar Nov 03 '16 20:11 selrond