How to remove "fatal: loose object"?

git, github

Solution

Easy answer: move the old repo away and reclone. If you have stuff in the old repo you want to preserve, there are ways of getting them, but first get a good repo.

Problem

One of my cloned repositories is getting this from a git fsck fatal: loose object 40bda4e3b79c3d7bf598df31d9e68470f97a3f79 (stored in .git/objects/40/bda4e3b79c3d7bf598df31d9e68470f97a3f79) is corrupt I've got another copy of it that fsck's cleanly. I've tried nuking the directory/subdirectories that contain the fatal one, and recloning it. The problem continues. I really don't care about any particular file, I just want the repository to checkout cleanly. What do I do? Note: the remote repository is hosted on github.

Original source

Related problems