Power outages, system crashes, or forced shutdowns during active Git operations (like committing, pulling, or pushing) often result in corrupted metadata files. This happens because the file-writing process is abruptly cut off mid-stream, leaving files blank, filled with null bytes, or locked.

warning: ignoring broken ref refs/heads/main

fatal: cannot lock ref 'HEAD': unable to resolve reference...

error: bad signature 0x00000000 / fatal: index file corrupt

Step 0: Create an Emergency Backup