h5_fya
Last Updated: February 25, 2016
·
7.415K
· forivall
Img  uv6opa

Fixing a corrupt local git repository

So last week, our git server was having issues and something got corrupted. Whenever I tried to fetch, I would get the following error message:

fatal: internal server error
remote: internal server error
fatal: protocol error: bad pack header

No amount of git fsck or git gc would fix the issue. The remote (gerrit) server was fixed, but was still some kind of unfixable corruption in my local objects.

The solution that other co-workers made was to make a completely new clone of the repository, but I didn't want to bother with the extra work that would entail, so I did this instead:

cp .git/config .git/config.backup
git remote remove origin
mv .git/config.backup .git/config
git fetch
Say Thanks
Respond

3 Responses
Add your response

11300
Cc22e760170e318c8339d3c3694882dc

I have the same problem, but this solution doesn't seem to work for me.

over 1 year ago ·
11301
Img  uv6opa

@mmontag Does re-cloning work? There's definitely a lot of ways that git can get corrupted, and its error messages aren't the best. I can't really help any further without more information

over 1 year ago ·
18044
None

works great!

over 1 year ago ·
Filed Under