A colleague showed me an issue with its bare repository
git fsck --full
error: corrupt loose object 'e82fe20e35ac4cda5dad3369abf3984d6280224d'
error: unable to unpack contents of
./objects/e8/2fe20e35ac4cda5dad3369abf3984d6280224d
error: e82fe20e35ac4cda5dad3369abf3984d6280224d: object corrupt or missing:
./objects/e8/2fe20e35ac4cda5dad3369abf3984d6280224d
Checking object directories: 100% (256/256), done.
Checking objects: 100% (5451/5451), done.
dangling blob ca82c960c8e2be046bac1b172cef6a8e14142d53
dangling blob a308c3c7ba71d04477768ff7a6c2c4ea1d9d1c3c
dangling commit d0cbfeada696c5e2686b3a9831a8fdb832675b79
dangling blob 8b92c1a1c85088043dff200ce42a4f7bf543f9b0
dangling commit 3d930dc778c0aabef397063a60d58dcbba7dd094
dangling blob 2c2159b5181c4b3c3ab5ed0216726f6d9bf9a04f
dangling blob 732d6bde83d2605aa9e9872a90d89482fd03662e
missing blob e82fe20e35ac4cda5dad3369abf3984d6280224d
dangling blob 2b70f7cc74ffed4fa51b8630ac9afafafd1d3853
dangling blob 2479f96766eecc50420b36b64ed9746f0f26eee8
dangling blob 64fb11950ff0def78d5b38b34c0a8e5bbc48942f
Curiously the file is there:
ls -al objects/e8/2fe20e35ac4cda5dad3369abf3984d6280224d
-rw-r--r-- 1 root root 9809893 Feb 16 22:43 objects/e8/2fe20e35ac4cda5dad3369abf3984d6280224d
And when I try to get the original file from my colleague I get the correct hash:
git hash-object -w foo.pdf
e82fe20e35ac4cda5dad3369abf3984d6280224d
Why does Git still complain about this missing blob and how to fix it?
EDIT
It seems the content of ./objects/e8/2fe20e35ac4cda5dad3369abf3984d6280224d isn't a zlib file. I get an error when I try to inflate it.
So I rm the object and regenerated the object with hash-object -w. This time everything is fine. I saved the repository.
However, I don't understand how what happened. The two blobs are very different one looks like a PDF the other is apparently nothing :
