1

Before starting I would like to tell that this may look like a duplicate question, but I have try those all & still facing the issue.

Now my issue is:

I was working in a local git branch suddenly the power went OFF & System turned OFF. Later, when power is back, I tried to pull my branch & it shown a message as:

../bug_11677 $ git pull
error: object file ./objects/3f/5774584d2f00d4adf0a82b5e2be0feee5c894a is empty
error: object file ./objects/3f/5774584d2f00d4adf0a82b5e2be0feee5c894a is empty
fatal: loose object 3f5774584d2f00d4adf0a82b5e2be0feee5c894a (stored in ./objects/3f/5774584d2f00d4adf0a82b5e2be0feee5c894a) is corrupt

I have tried:

  1. Remove git index & tried to reset by keeping the changes in file:

    git reset --keep

  2. Tried by removing git object folder:

    find .git/objects/ -type f -empty | xargs rm

    git fetch -p

    git fsck --full

  3. Tried one as below:

    rm -f .git/objects/3f/5774584d2f00d4adf0a82b5e2be0feee5c894a

    git fsck --full

When I tried the last one, it shown:

Checking object directories: 100% (256/256), done.
Checking objects: 100% (342770/342770), done.
Checking connectivity: 342315, done.

Later I pulled the branch, then again I got the corrupted message.

  1. I have also tried to clone my branch newly, but failed by same error.

I have gone through below links:

Sinto
  • 3,915
  • 11
  • 36
  • 70

1 Answers1

0

I was working in a local git branch suddenly the power went OFF & System turned OFF

That is a local event, meaning you were not in a middle of a push, meaning no impact to the remote repo.

A downgraded solution would be to clone the repo again, and report your current modification to the branch. Then push.
That might mean a slight loss of history on that branch.

If however, the issue persists during a clone, then the power outage did not affect just your workstation, but also the Git hosting repositories server.

The OP Sinto confirms in the comments:

I have called server tech & checked the issue.
He said that was Git files where corrupted in server and it is fixed now from the server side.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • As I mentioned in the question, I was not able to clone the same branch. Same issue was there on clone the same branch. There I failed actually. – Sinto Dec 03 '18 at 09:21
  • @Sinto Even after a fresh new clone of the remote repo? What I don't understand is: you dod not push anything at the time of the outage, so a new clone should be possible. – VonC Dec 03 '18 at 09:23
  • I'm was not able push anything after this issue.. but still the error showing there. Same happened when I tried to pull my other git branchs which was not in use at the power failure time. – Sinto Dec 03 '18 at 17:39
  • And what happen if you pull push from a new locally cloned repo? – VonC Dec 03 '18 at 17:46
  • In both(pull, push or clone) case it show same error. No problem now, because I have called server tech & checked the issue. He said that was git files where corrupted in server & it is fixed now from the server side. And now I'm creating my branches in git & merging it with the backup file what I have in my local. – Sinto Dec 04 '18 at 10:30
  • Thanks for your valuable time. – Sinto Dec 04 '18 at 10:30
  • @Sinto Great! I have included your comment in the answer for more visibility. – VonC Dec 04 '18 at 11:43