Artem Tikhomirov
Artem Tikhomirov

Reputation: 21676

Git "bad sha1 file" error

Hello I have the following error by git-fsck, which cannot be cleaned by git-gc even in --aggressive mode. What can I do next to fix this repository error?

$ git-fsck
bad sha1 file: .git/objects/55/tmp_obj_a07724

Upvotes: 10

Views: 9477

Answers (3)

Serg Kryvonos
Serg Kryvonos

Reputation: 4667

From man git-fsck:

Any corrupt objects you will have to find in backups or other archives
(i.e., you can just remove them and do an rsync with some other site in
the hopes that somebody else has the object you have corrupted).

Upvotes: 0

Jordi Bunster
Jordi Bunster

Reputation: 4906

It's not a simple answer, sadly. But this might help:

Recovering from repository corruption (from the Git's user manual).

Upvotes: 8

Damien Diederen
Damien Diederen

Reputation: 2474

Err... tmp_obj_a07724 suspiciously looks like a leftover temporary file :)

What happens if you simply move it away from the .git directory (after a backup of the whole thing)?

Upvotes: 7

Related Questions