How can I recover my Git repository for a "missing tree" error?

Justin Guertin picture Justin Guertin · Aug 30, 2011 · Viewed 54.4k times · Source

We are using Gerrit for our Git repository. On a project that has been active for several months, we are suddenly unable to push any changes. When we execute git push we see the following error:

error: unpack failed: error Missing tree 14d62f0ed4385e3f68f226ac133fa9932a9c65c9

Executing git fsck --full yields:

dangling tree 2701c92fb6eab1826482f6bcc9598413e651a92a  
dangling blob c505b3b12cfacd1e26dec8dc559820a30fc20c27  
dangling blob 8907f94b5b4ec881e1b86d50681795e368c167ff  
dangling blob 4938d9fc34c6e2f92c68872bfec6e070b2b3a9c2  
dangling blob 8a5c8b8d35484ea1470e2d8e6c482fcb97b23d0f  
dangling commit 3072d3314e20bf6c6998e1c02986d83019d3e1df  
dangling tree 5377d7f7111d340854c3ee0946667c202227e603  
dangling tree c3783e9ab540457924ceb9f9fb5ea1c2b97472b1  
dangling blob 8b92d1765038e4ec5e721f98a2aabb305a7f9819  
dangling tree 38a03153f0f18ca15846e9bd4983a86800a43a94  
dangling commit 8db2d6ae5364174bebe13720a359ddb2e62d4c9d  

All of our developers are experiencing the same error when they try to push. So far, we've tried re-initializing the gerrit repo (git init --bare ...) and pushing up to it. We've also tried creating a new gerrit project with a separate repo. In the end, we keep getting the same error.

Does anyone have any insight on what the cause would be, or how to recover?

Answer

Filip picture Filip · Sep 23, 2015

Use git push --no-thin instead of git push.

From Git docs:

A thin transfer significantly reduces the amount of sent data when the sender and receiver share many of the same objects in common. The default is --thin.