Rebuild loose missing tree in Git when there are no other missing objects

My Git repository claims there is a corrupted object: running git fsck --full says that there’s a corrupted loose object in the repo. Since the object is corrupted, I can’t unpack it using git cat-file -t, but removing the file causes fsck to report only:

broken link from tree 93e54230ef...
            to tree 5aec4ad...
missing tree 5aec4ad...

I think this missing tree is the only file that is missing, or rather that there are no dangling commits/blobs, because running git ls-tree 93e54230ef... shows only one line: 040000 tree 5aec4ad... android. Also, the last-modified date on the corrupted file is yesterday, and I haven’t made any changes since then. Unfortunately, I’ve checked the clones I have of this repository, but none of them have the missing object packed or unpacked.

  • Repair corrupted git repository
  • git clone failing, can't repack on remote
  • Git recovery: “object file is empty”. How to recreate trees?
  • Jar file gets corrupted after pushing to github
  • Git responds with 'error in sideband demultiplexer'
  • Should I worry about `git fsck` warning: “contains zero-padded file modes”
  • How can I rebuild a missing git tree with no dangling commits or blobs?

  • visualizing progress on git repositories
  • git cherry-pick from from feature branch, now rebasing against master loses all commits
  • How can I color Git branches based on their names?
  • undo “git filter-branch … — --all”? in one command?
  • i push a local index.html to repository but index.html file is empty
  • Is there a better way to review your own changes instead of “git diff”
  • One Solution collect form web for “Rebuild loose missing tree in Git when there are no other missing objects”

    When all that is missing in Git is a tree, the solution is simply to use write-tree:

    git write-tree

    After executing that command, the Git repository should revert to its previous state.

    Git Baby is a git and github fan, let's start git clone.