Page 1 of 1

Git failed with a fatal error

Posted: March 26th, 2019, 9:39 pm
by krautersuppe
error: bad signature
fatal: index file corrupt
This came up in my project so I first tried this advice which got me only in more trouble.
After that I tried some stuff that is written here.
That got too complicated for me so i just run

Code: Select all

git reflog
in repo directory and it churned out all my commits and their numbers.
I then reset git to second commit from end with

Code: Select all

git reset --hard commitnumber
It did return my code to normal however corrupt release folder in x64 stayed corrupt.
My project is on external data storage drive so i just run

Code: Select all

chkdsk
on it and it solved the remaining issue.

Re: Git failed with a fatal error

Posted: March 26th, 2019, 11:22 pm
by albinopapa
Geez, hope your HD isn't going out, hopefully you upload to GitHub, Dropbox, ButBucket, OneDrive, etc...

Re: Git failed with a fatal error

Posted: July 10th, 2020, 1:13 pm
by krautersuppe
So it turns out that even if all changes have been commited, if there is a power-out while visual studio is open it will somehow corrupt the .git folder and after restart local repository is no more in the list and when trying to open solution file it says:

fatal: Not a git repository (or any of the parent directories): .git

After running git init in cmd it shows that : Reinitializing existing git repository in c:/.../../.git/
However after git status it is still fatal: Not a git repository (or any of the parent directories): .git
If I try to copy HEAD from logs then it becomes git status : fatal: bad object HEAD

I am so tilted :evil:

Edit: Ok so after git symbolic-ref HEAD refs/heads/nameoflastcommitedbranch
and some commits and reverts and change of icon it did return to original state
I am still so fucking tilted :evil:

Re: Git failed with a fatal error

Posted: July 11th, 2020, 3:33 am
by albinopapa
Wow, I would be also