Bad object in GitHub repo

AI-generated summary

Users are experiencing a ‘bad object’ error when trying to access a specific commit (92dc829df56cf5166bdeb0b2463a0b1bcbac8238) in the Discourse GitHub repository, particularly with Git 2.0.0 and above. floriandotorg reports the issue occurs during git push with submodules. supermathie identifies the object as an orphaned tag from an old release that should no longer exist in the repository. While git gc removes the object locally for some, floriandotorg confirms it persists. supermathie suggests fetching all tags and running git gc again. sam recommends the simplest solution is to delete and re-clone the repository.

Hi,

we’ve encountered the following problem:

git clone https://github.com/discourse/discourse.git
cd discourse/
git show 92dc829df56cf5166bdeb0b2463a0b1bcbac8238
fatal: bad object 92dc829df56cf5166bdeb0b2463a0b1bcbac8238

As far as we know, this only occurs on git >= 2.0.0, git 1.9.3 works fine.
Neither fsck, repack or gc helps.

The bad object causes many problems, especially when you’re working with submodules.

It would be really helpful, if someone could fix it.

Can we repro this @sam?

I can repro, but I have no idea how to fix it.

I am not sure there is an error here, this is a standard error message:

sam@ubuntu discourse % git show 6666666666666666666666666666666666666666
fatal: bad object 6666666666666666666666666666666666666666

I found it an old repo:

→ git show 92dc829df56cf5166bdeb0b2463a0b1bcbac8238 | head
tag latest-release
Tagger: Neil Lalonde <neillalonde@gmail.com>
Date:   Fri Jan 24 15:21:39 2014 -0500

latest release

compare to:

→ git show latest-release | head
tag latest-release
Tagger: Neil Lalonde <neillalonde@gmail.com>
Date:   Mon Mar 2 18:32:21 2015 -0500

latest release

Looks like 92dc… is an orphaned object for an old tag - it would no longer be in the repo on github. It’ll get clobbered when we push a new latest-release tag.

After running git gc, 92dc… is no longer in my local repo.

@floriandotorg: why did you start using 92dc… ?

@supermathie Thanks for your help.

We don’t use it, git complains about this bad object on git push with --recurse-submodules=on-demand flag, as well as do many submodule commands.

git gc doesn’t remove it on our side.

try: git fetch --all to update your tags then git gc

Not sure why you would even see it in a fresh repo - it’s not there. Something must be referring to it.

Simplest fix for anything odd like this on dev is to nuke the repo and start from scratch