Git push error: object file is empty / free object is damaged

I tried to commit git using git Gui. I put a few files, and then the computer suddenly turned off due to a low battery. I turned it on, turned it on again, and made the files I wanted. Then I ran git push, as I already did a million times, no problem, and this time I got the following error:

Counting objects: 8, done.
error: object file .git/objects/b5/60c934f6bad40f4f246973afc0139ed91a2d32 is empty
Compressing objects: 100% (4/4), done.
error: object file .git/objects/b5/60c934f6bad40f4f246973afc0139ed91a2d32 is empty
fatal: loose object b560c934f6bad40f4f246973afc0139ed91a2d32 (stored in .git/objects/b5/60c934f6bad40f4f246973afc0139ed91a2d32) is corrupt
error: failed to push some refs to 'git@bitbucket.org:joemorano/app.git'

Could this be caused by a computer shutdown before I could execute the first commit?

Before all this happened, I apparently messed up the production version of my application by running bundle installas root on my server, and now everything on the server is corrupted, but I don’t see how this can affect the local version. I never did git pullor anything like that.

Has anyone encountered this error before?

+4
source share
2 answers
... failed to push some refs to 'git@bitbucket.org:joemorano/app.git'

Could this be caused by a computer shutdown before I could execute the first commit?

Definitely yes.

Has anyone encountered this error before?

Repair corrupted git repository

See also: How to fix a damaged git repository?

, () , () , , () / , () . , , . ( , , , , , - .)

+6

1: .git( , - , , .git-old-1,.git-old -2 ..):

cp -a .git .git-old

2:

git fsck --full

: error: object file.git/objects/0A/dsdadadadaaeer4r3434343434334f

3: , .git/objects/. .

4.

git fsck --full

5: git reflog. , HEAD .

6: reflog:

git log origin/master..HEAD

7: , 6 , HEAD . :

git show commit-id 

8: HEAD commit-id

git update-ref HEAD commit-id

, .

+4

All Articles