lazygit: fatal: Unable to create `../index.lock`: File exists.

For some time now lazygit seems to bug all the time. I’m 100% sure that there are no other programs running in the background that could do some git operations.

I try to open lazygit from the terminal, but everytime I try to do any operation after that I get the error about the git lock. So I remove it by hand rm -rf .git/index.lock and get back to lazygit, same thing.

It doesn’t matter if I do this from bare console or from the console inside neovim. Sometimes after deleting the index.lock file and getting back it works fine, only to complain again a usage later.

If I remove the file manually and then use git commands instead of using lazygit, everything works fine.

image

Windows, but I’m on WSL2 kali-linux Linux stacjonarny 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 GNU/Linux Lazygit version 0.34

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (6 by maintainers)

Most upvoted comments

Still meet this issue on 0.40.2.

My experience is that when this lock window appear, I exit lazygit, delete the index.lock file, and enter lazygit, then:

  • If I stage one file by hitting space on one file, the lock window appears again.
  • If I stage all files by hitting a, the lock window won’t appear. Then if I hit a again to unstage, and stage one file, the lock window won’t appear.

Welp, fun while it lasted

image

Uhhh, well then… try updating? 😅