git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JGJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date
Sep 16, 2013, 18:28 UTC
Message-ID
<20130916182852.GA14513@obsidianresearch.com>
Scenario, run:
 $ git rebase  v3.10.12 --autosquash  -i
And randomly get this:
 fatal: Unable to create '.../linux/.git/index.lock': File exists.
 If no other git process is currently running, this probably means a
 git process crashed in this repository earlier. Make sure no other git
 process is running and remove the file manually to continue.
 Could not apply ....

I've noticed this happening randomly for a few years now, and always chalked it up to NFS weirdness, but I figured out what is going on today (as I am not using NFS right now)..

I have emacs windows open that have files within the git tree open in them. My emacs has vc-git mode loaded and global-auto-revert-mode set.

During the rebase the files open in emacs are changed by git, when emacs notices this (which is random with respect to the ongoing rebase) it auto reverts and runs git commands (due to vc-git), which causes the rebase to randomly fail.

Worse, I've noticed that this also randomly seems to cause the rebase to loose a commit if you --continue from that point.

Can git have some retry in the locking so this doesn't happen?
Jason
Next: Jeff King
Message 1 of 4 in “Git rebase dies with fatal: Unable to create '.../.git/index.lock': File exists.”
  1. Jason GunthorpeSep 16, 2013
  2. Jeff KingSep 16, 2013
  3. Jason GunthorpeSep 16, 2013
  4. Jeff KingSep 16, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.