7

I'm getting these errors:

X:\WAMP\www\topsecret>git fsck --full
error: inflate: data stream error (invalid code lengths set)
error: corrupt loose object '18076434b9cad667dbcf5be20162c506c95c2f55'
fatal: loose object 18076434b9cad667dbcf5be20162c506c95c2f55 (stored in .git/objects/18/076434b9cad667dbcf5be20162c506c95c2f55) is corrupt

I'm a total noob when it comes to GIT and my search for this exact error has come up with nothing. I'd really like to save this repo since it goes way back. Thanks.

GIT Version: 1.7.7.msysgit.0

Jaybuz
  • 95
  • 1
  • 1
  • 6

1 Answers1

2

see if you can find a cloned repo and manually copy that object.

Here is how you can move an object:

http://www-cs-students.stanford.edu/~blynn/gitmagic/ch08.html#_the_object_database

objects are zipped so you can't just store the uncompressed contents directly into the objects directory.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • I checked the bare repo on my web server that I push to and that file doesn't exists there. Here's a picture of the directories side by side: http://i.jaybuz.me/20120217012958888.png – Jaybuz Feb 17 '12 at 01:30
  • 1
    It may be packed. "git show " – Adam Dymitruk Feb 17 '12 at 02:58
  • Ah, yes! So how do I download it? Terminal is displaying it messed up. Would it not be corrupted as well, since it's updated via my corrupted repo? – Jaybuz Feb 17 '12 at 18:54
  • I just did 'git fsck --full' on the remote repo and everything looks clear! – Jaybuz Feb 17 '12 at 19:07
  • You can stream the output to a file. Then you can store that object locally. – Adam Dymitruk Feb 17 '12 at 21:19
  • I managed to get the file and replace it locally but I'm still getting the corrupt error: X:\WAMP\www\topsecret>git fsck --full fatal: loose object 18076434b9cad667dbcf5be20162c506c95c2f55 (stored in .git/obj ects/18/076434b9cad667dbcf5be20162c506c95c2f55) is corrupt – Jaybuz Feb 17 '12 at 22:37
  • You need be able to store the object properly. You can't just copy the file in. – Adam Dymitruk Feb 17 '12 at 22:48
  • Added a comment to clear this up. – Adam Dymitruk Feb 17 '12 at 22:52
  • Running $ git cat-file -p 18076434b9cad667dbcf5be20162c50 6c95c2f55 > ~/076434b9cad667dbcf5be20162c506c95c2f55 on the remote seems to output exactly the same file as $ git show – Jaybuz Feb 17 '12 at 23:49
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/7870/discussion-between-jaybuz-and-adam-dymitruk) – Jaybuz Feb 18 '12 at 00:01
  • I had the same issue. The answer at this [link](http://stackoverflow.com/questions/801577/how-to-recover-git-objects-damaged-by-hard-disk-failure) gives details as to how to solve. – sleeves Feb 06 '14 at 17:08