[Solved] Git error: inflate: data stream error (invalid block type) error: corrupt loose object

Error reported when using git push
error: Insert: data stream error (invalid block type)
error: corrupt loose object ‘c8b7f5f344dbfe7d5b7339b977873c21f71478aa’

I tried many methods. Finally, I cleared the local git, fetched it and pushed it again:

rm -rf .git # Delete the local git repository
# Resume local git repository
git init 
git remote add origin Your repository link
git fetch # git pull = git fetch + git merge
git reset --hard origin/master 
git branch --set-upstream-to=origin/master master  

Read More: