When pulling my repos as usual (via a short C program which pulls many repos, no matter whether changes occurred), one of them printed the following message:
error: object file .git/objects/eb/4384d0e2460629d912635ec622beb979024316 is empty
error: object file .git/objects/eb/4384d0e2460629d912635ec622beb979024316 is empty
fatal: loose object eb4384d0e2460629d912635ec622beb979024316 (stored in .git/objects/eb/4384d0e2460629d912635ec622beb979024316) is corrupt
fatal: The remote end hung up unexpectedly
The same message (sans the last line) was printed upon executing git status
in the repository.
This question is not about how to restore data or anything like that. It's about understanding how this happened.
The repository only has 1 remote and only I use this remote (via several machines). I work directly on master in this repo and there are no other branches. The remote is accessed via ssh. 35 repos were pulled at that time and only this one repo broke.
It appears that the last change in this repository was made on the machine where the error occurred and was already committed and pushed to the remote.
I'm guessing this from the facts that latest commit in the remote is something I would have done on the machine whose repo broke and that the working directory after it broke doesn't contain any changes as git status
reports a clean repo if I clone again from the remote and copy the working directory of the broken repo over to the fresh clone. Unfortunately, I can't use git log
on the broken repo as it only prints the above-mentioned error message (sans the last line, of course).
When does a repo break like this? To me, it seems like the repo was in the perfect condition for absolutely nothing to happen.
Should it matter: The broken repo is in my home folder on an Ubuntu 16.04 (Kernel 4.8.0-58-generic
) laptop which uses an ext4 partition and Ubuntu's default home folder encryption (eCryptfs).
This is the source code of the program I used to pull: https://pastebin.com/bBTz4vH2