Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Sabrethan opened this issue Jul 18, 2016 · 40 comments
Closed

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

Sabrethan opened this issue Jul 18, 2016 · 40 comments

Comments

@Sabrethan
Copy link

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.
@Stanzilla Stanzilla added the 👆 Git Upstream issue in Git for Windows. label Jul 18, 2016
@phith0n
Copy link

phith0n commented Jul 31, 2016

I also have the problem. Why close the issue ?

@Stanzilla
Copy link
Member

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

@phith0n
Copy link

phith0n commented Jul 31, 2016

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

@Stanzilla
Copy link
Member

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

@phith0n
Copy link

phith0n commented Jul 31, 2016

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

@acrap
Copy link

acrap commented Aug 2, 2016

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.

@r1z1
Copy link

r1z1 commented Sep 5, 2016

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.

@ghola
Copy link

ghola commented Sep 6, 2016

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
Copy link

ghola commented Sep 6, 2016

It seems to be the same issue as here: #1060

@cringerjs
Copy link

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

@stefan-wiesner
Copy link

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.

@oskarlind
Copy link

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

@nerzid
Copy link

nerzid commented Sep 27, 2016

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 😭

@Demers94
Copy link

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.

@MartiUK
Copy link
Member

MartiUK commented Sep 27, 2016

Fixed in #1101

@MartiUK MartiUK added 🐛 Type: Bug Default User Configuration and removed 👆 Git Upstream issue in Git for Windows. labels Sep 27, 2016
@ogrishman
Copy link

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

@MartiUK
Copy link
Member

MartiUK commented Oct 17, 2016

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

@ogrishman
Copy link

@MartiUK, Thank you!

@ClementParis016
Copy link

ClementParis016 commented Oct 23, 2016

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

@selrond
Copy link

selrond commented Nov 3, 2016

Same problem here

@daxgames
Copy link
Member

daxgames commented Nov 3, 2016

rm .git/index.lock

@selrond
Copy link

selrond commented Nov 3, 2016

@daxgames it is not a solution, bundled git.exe always create new index.lock and prevents commiting. Solved in the latest build though

@WillJE
Copy link

WillJE commented Aug 9, 2017

it's locked,you can use GUI to unlock it and then everything will be fine, i just tried it

@cringerjs
Copy link

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

@twinsec
Copy link

twinsec commented Oct 2, 2017

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.

@Stanzilla
Copy link
Member

Might get a real fix soon git-for-windows/msys2-runtime@78e2dee

@AnilKumar345
Copy link

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:

  1. Open local repository
  2. By default .git is hidden while initializing local repositort, unhide .git folder.
  3. OPen .git folder
  4. Under this "index.lock" file is available, delete that file

@svchraghava
Copy link

the above solution worked for me thanks

@RaviUmraliya
Copy link

@AnilKumar345
this solution work thanks

@nmarseaud
Copy link

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.

@brady800526
Copy link

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.

@herijaona
Copy link

solution : rm -Force ./.git/index.lock

@abhinavJai
Copy link

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

@lucas0000miranda
Copy link

lucas0000miranda commented Dec 28, 2018

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

@daxgames
Copy link
Member

@lucas0000miranda how does this have anything to do with cmder if you are on mac osx given cmder is a Windows only app?

@lucas0000miranda
Copy link

@daxgames hmmm not sure. I just put that in context make sure that this implementation will work for MAC users.

@lucas0000miranda
Copy link

@daxgames and also this is a issue in index.lock file on GIT in general. Not just for cmder.

@MohsinRaz3
Copy link

I am facing same issue saying /index.lock with "another git process seems to be running.. " on my command line Git Bash terminal

@Sathri-Mamatha1127
Copy link

the above solution worked for me thanks

How u done ..........................where i have to open local repositary

@chandu575
Copy link

@AnilKumar345
this solution work thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests