is there a way to fix the following errors after git commit -m?

Viewed 107

error: object file .git/objects/6f/86cfe9e175144c6db9ac72775a49ffc0fbd336 is empty

error: object file .git/objects/6f/86cfe9e175144c6db9ac72775a49ffc0fbd336 is empty

fatal: loose object 6f86cfe9e175144c6db9ac72775a49ffc0fbd336 (stored in .git/objects/6f/86cfe9e175144c6db9ac72775a49ffc0fbd336) is corrupt

in addition when I access the folder I want to work with I get:

zsh: corrupt history file /home/mvmarco/.zsh_history

2 Answers

Looks like you suffered a hard system crash and lost inflight work. The nuclear option is delete those files, reset to the previous commit, redo it. The copy in your work tree will be good, at least, I don't know how WSL or Windows handles filesystem caching but with any luck they didn't get too aggressive with that, anyway delete the corrupt in-flight files those messages are telling you about, reset to the previous commit, check git status, redo any work that got lost in the crash.

SOLVED WITH:

  1. āžœ find .git/objects/ -size 0 -exec rm -f {} ;
  2. āžœ git fetch origin

then git status was clean and I pushed to git hub successfully

Related