2

Problem:

You use the VCS system in Intellij and try to commit stuff. Commit fails and Intellij claims that index.lock exists. You check .git/index.lock in your repo directory and find out that it does indeed not exist.

Setup:

  • Intellij Ultimate 2018.1
  • Java 8 project
  • Git 2.16.1
  • Windows 10

I tried creating a an index.lock file manually and then deleting it with git bash and also with Windows cmd. Did not work. I checked that there were no other programs using git. I restarted my PC and made sure nothing used Git.

I used Git Bash and committed manually without Intellij. Works perfectly fine. But after that the VCS commit in Intellij still claims that index.lock exists.

Similar questions that line out solutions that did not work: Git - fatal: Unable to create '/path/my_project/.git/index.lock': File exists

2
  • 1
    Maybe you should file a bug report? After all, there is no programming involved in your question but the use of some tool that you bought. Commented Apr 19, 2018 at 19:33
  • 1
    While I agree filing a bug report is good advice, I'll respectfully note that questions don't necessarily need to have code in them, as software tools commonly used by programmers is specifically on-topic, and that intellij-idea is a sponsored tag partly thanks to that, and certainly qualifies. Commented Apr 19, 2018 at 19:38

2 Answers 2

4

index.lock does clearly not exist and it still refues to commit.

Solution:

  • Create index.lock in windows explorer in the .git directory.
  • Open the terminal in Intellij
  • Type: rm .git\index.lock

You can commit again. Wierd thing is that Intellij terminal just uses basic Windows cmd commands. I tried plain Windows cmd as lined out in other answers but it did not work. Only the terminal in Intellij works.

Sign up to request clarification or add additional context in comments.

2 Comments

perhaps a permission issue?
Since your problem has been solved, you can mark the answer. And it will also benefit others who have similar questions.
2

IntelliJ uses the external git client, so it was definitely git claiming the file exists. As a wild guess, there could be 2 git repositories in the project and the lock existed in one of them. It is really hard to tell without the logs, so if you face the issue again, please submit a bug report as proposed in the comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.