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

Out-of-repository file remove error

From
Nick Andrew <nick@nick-andrew.net>
Date
Jul 19, 2008, 08:23 UTC
Message-ID
<20080719082314.GA15419@mail.local.tull.net>

git rm seems to have a problem with removing a file from a repository when the repository .git and working tree are not in the current directory. It leaves an index.lock file.

Here's a script to show the bug:

mkdir Bugtest cd Bugtest git init date > newfile git add newfile git commit -m 'Added' newfile cd .. git --git-dir=Bugtest/.git --work-tree=Bugtest rm newfile ls -l Bugtest/.git/index.lock

Output:
Initialized empty Git repository in .../Bugtest/.git/
Created initial commit 43dec15: Added
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 newfile
rm 'newfile'
fatal: Unable to write new index file
-rw-r--r-- 1 nick nick 32 Jul 19 18:20 Bugtest/.git/index.lock
I tested on:

git version 1.5.6.2 git version 1.5.6.3.440.g9d8f

Nick.
Next: Olivier Marin
Message 1 of 3 in “Out-of-repository file remove error”
  1. Nick AndrewJul 19, 2008
  2. builtin-rm: fix index lock file pathOlivier Marin, Jul 19, 2008
  3. builtin-rm: fix index lock file pathOlivier Marin, Jul 19, 2008

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.