Due to an old bug in egit's implementation of the git push command, remote repositories can become corrupted due to missing objects.

git fsck
# broken link from  commit 5b90a930763c442f0fc3d819685083b4eda69f8e
#               to  commit e1ea55d308b7808cb982f509c8dfa199ada4677e
# missing commit e1ea55d308b7808cb982f509c8dfa199ada4677e

This can prevent cloning and fetching from the repository. The objects were never pushed to the remote repository, therefore GitHub support cannot correct the repository. The only solution is for the user that pushed the commits to push them again from the command line.

Correcting the remote repository

To correct the remote repository, the missing objects need to be re-pushed from an uncorrupted repository. This should be done from the command line, not from egit. To start, run git fsck on your local repository to ensure it has not been corrupted. If you do not receive any errors about broken links or missing objects, you're clear to continue.

Warning: If you cannot find the original uncorrupted repository this error can not be recovered from without data loss. If the original repository has been deleted, the remote repository may be repairable, but the missing objects will be lost. If you run into this, please contact support.

Re-pushing simply involves deleting the branch and then pushing it again. We'll use the first commit in the branch so that we can ensure all the other commits are re-pushed.

If the branch being deleted is the default branch on the remote, you'll need to replace it temporarily.

git rev-list --max-parents=0 HEAD
# Find the first commit
# 3b70d98cb968fc35f0c99acfe4d5dfa976ed2536

git branch temp_default 3b70d98cb968fc35f0c99acfe4d5dfa976ed2536
# Create a temporary branch at that commit

git push origin temp_default
# Push the temp branch to github

Load up the repository's admin page and change the default branch to temp_default:

Branch selection dropdown

git push origin --delete master
# Remove master from the remote

git push origin master
# Re-push master

You can now change the default branch back on the repository's admin page.

git push origin --delete temp_default
# Remove the temp branch

You may need to do this for several branches if the remote repository has more than one branch that was pushed by egit. You can skip the default branch change for these other branches. If the branches overlap you should roll them all back first, before re-pushing each one.


Once you've finished re-pushing, testing the repository is just a matter of cloning it:

git clone git@github.com:user/repo.git
# Initialized empty Git repository in /Users/you/repo/.git/
# remote: Counting objects: 1815, done.
# remote: Compressing objects: 100% (838/838), done.
# remote: Total 1815 (delta 1139), reused 1552 (delta 961)
# Receiving objects: 100% (1815/1815), 537.69 KiB | 549 KiB/s, done.
# Resolving deltas: 100% (1139/1139), done.

If you have re-pushed all branches in your repository and cloning still fails, please contact support. Be sure to include a link to your repository and mention that you've already performed all the steps on this page.

Avoiding future corruption

This issue has been fixed in newer versions of egit. Ensure all your users have updated their installations before they make any further pushes using egit.