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

Problems with stale .keep files on git server

From
Johan Herland <johan@herland.net>
Date
Mar 31, 2011, 10:46 UTC
Message-ID
<201103311246.25645.johan@herland.net>
Hi,

I have a problem in a server repo where it seems that some previous "git push" command by some user has left a stale .keep file in the repo.git/objects/pack/ directory.

Now, when trying to clone the repo on the server, the clone fails with:

$ git clone --bare /path/to/repo.git myclone.git Cloning into bare repository myclone.git... fatal: failed to copy file to 'myclone.git/objects/pack/pack-6195737bf980830662f9a44eced023ca4ebe083a.keep': Permission denied

(This is a local clone across filesystems, which I assume simply copies the objects/ directory from the source repo)

Looking at the .keep file that it's trying to copy from the source repo, it is owned by the same user as the corresponding .pack and .idx files, but while the .pack and .idx files have 0440 permissions, the .keep file has 0600 permission (which explains the "Permission denied" error). The .keep file itself contains the following text:

  receive-pack 6932 on gitmain
(where gitmain is the hostname of this server)

The timestamp on the .keep file is over a month old, and there is currently no process with ID 6932 running on this server.

AFAICS, this indicates that someone pushed this pack over a month ago, and for some reason it failed/aborted, and left the .keep file lying around. From browsing the source, I see that the .keep file is created by receive-pack protect the pack from a concurrent "git gc" while it is being created. However, I have yet to find under which conditions receive-pack will die without removing the .keep file.

Some questions:
1. Why does the .keep file have 0600 permissions (preventing a local
   clone by any other user)
2. Under which conditions will receive-pack leave stale .keep files
   in the filesystem? Is this a bug?
3. Do I need to scan for and remove stale .keep files in a cron job
   in order to keep repos healthy and clonable?
Thanks,
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Next: Jeff King
Message 1 of 14 in “Problems with stale .keep files on git server”
  1. Johan HerlandMar 31, 2011
  2. Jeff KingMar 31, 2011
  3. 1/2 index-pack: Create .keep files with same permissions and .pack/.idxJohan Herland, Apr 1, 2011
  4. Junio C HamanoApr 1, 2011
  5. Jeff KingApr 1, 2011
  6. Shawn PearceApr 1, 2011
  7. Junio C HamanoApr 1, 2011
  8. Johan HerlandApr 1, 2011
  9. Junio C HamanoApr 2, 2011
  10. Johan HerlandApr 3, 2011
  11. Johan HerlandApr 1, 2011
  12. 2/2 repack: Remove stale .keep files before repackingJohan Herland, Apr 1, 2011
  13. Jeff KingApr 1, 2011
  14. Johan HerlandApr 1, 2011

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.