LKBEN11533: Git error: unable to create ... .git/index.lock: file exists


Symptom

You are working in git and it is imposible to add, push or pull anything

Cause

Git has made an index.lock file in your .git directory and this file is the cause of the problem.

Solution

$ git add somefile.txt
fatal: Unable to create 'something/.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.

You need to go into the .git directory and remove the lock-file manually.

cd .git
rm index.lock

Now you can add, pull and push again.

Have fun.

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.

Latest update: 03/03/2022 | Comment: