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

Recovering from missing objects?

From
GUGeert Uytterhoeven <geert.uytterhoeven@sonycom.com>
Date
Feb 19, 2009, 14:08 UTC
Message-ID
<alpine.LRH.2.00.0902191447040.16988@vixen.sonytel.be>
	Hi all,

I start to see suspicious messages about missing objects in one of my working repositories:

| vixen$ git gc
| error: Could not read c406ab0be69c912ea59233595a071478103cdad8
| fatal: bad tree object c406ab0be69c912ea59233595a071478103cdad8
| error: failed to run repack
| vixen$ 
My setup:
  - I have one reference repository (cloned from Linus' linux-2.6.git)
  - I have several working repositories, cloned using --reference to my
    reference repository. A working repository has several remotes (cloned from
    other Linux kernel repositories).

I always do a `git pull' in the reference repository, before doing a `git remote update' in a working repository. When I do `git gc' in a working repository, it cleans up all objects that are not in the reference repository. Hence I only need to care about backup of the .git directories in the working repositories (the stuff I'm working on), and not about the reference repository (its objects are publicly available and replicated all over the world).

I identified the missing object listed above to be part of a remote repository. Doing a `git remote update' doesn't fetch it again, as git is too smart and thinks I already have everything.

If I clone the remote repository, I have the object in the new clone. However, how do I get the missing object back into the .git directory of my working repository? Is there an easy way to do that, or should I just recreate my working repository from scratch, and reimport anything I can recover?

As for the cause of the problem: most probably I once added the remote repository to my reference repository, and removed it later, causing all objects to be removed during a subsequent gc.

Thanks for your answers!
With kind regards,

Geert Uytterhoeven Software Architect

Sony Techsoft Centre Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010

Next: Junio C Hamano
Message 1 of 6 in “Recovering from missing objects?”
  1. Geert UytterhoevenFeb 19, 2009
  2. Junio C HamanoFeb 20, 2009
  3. Jeff KingFeb 20, 2009
  4. Junio C HamanoFeb 20, 2009
  5. Jeff KingFeb 20, 2009
  6. Geert UytterhoevenFeb 20, 2009

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.