tags:

views:

252

answers:

2

Is there any way I can repair my repository with commit history in tact.

 # git log
fatal: object 01aeb2bf2e93b238f0e0422816b3e55518321ae7 is corrupted

From reading the link below it looks like I'll have zap it and start over.

http://www.miek.nl/s/7e76eadefe/

+2  A: 

Do you have clones of this repository elsewhere? You might want to read this post by Linus Torvalds to restore that corrupted object, assuming the corrupted object is a blob (file contents).

Bram Schoenmakers
No clones. I just set this up yesterday. So I only had 10 commits.I ended up starting fresh. But will definitely push it somewhere else at the end of every day. Lesson learned.Still glad to be off svn. Git is fast!
Keyo
+1  A: 

I wound up in the same situation, probably due to an improper shutdown of the virtual machine I was working in. There were approximately 10 objects in .git/objects that had zero length. As far as I can tell, the actual source code files were fine, just the repository was hosed.

$ git status
fatal: object fbcf234634ee04f8406cfd250ce5ab8012f92b08 is corrupted

Per some suggestions I saw elsewhere (including Linus's post referenced above), I tried temporarily moving the corrupted objects git was complaining about from .git/objects elsewhere. When had moved all of them, I got:

$ git status
fatal: bad object HEAD

After about an hour of Googling and trying various solutions, I gave up and started a new working copy using 'git clone' to pull from the origin (which was about 2 hours behind my working copy). I then used rsync -rC (-C excludes SCM files) to copy the changed files from the messed-up working copy to my new working copy.

Jase