Subject: Re: Git bug report - disk errors on Windows after push

From: Neeraj Singh <[email-masked]>
Date: Thu, 21 Apr 2022 13:08:31 -0700

On 4/20/2022 7:29 PM, Attila Csosz wrote:
> Please check this link also
> https://github.community/t/what-could-be-the-reason-my-git-repositories-keep-getting-corrupted-broken/184711
> 
> You can found many link on web on 'git corrupted repository'. In my
> opinion when a git repository is corrupted on Windows there is a good
> chance to HDD errors.
> 
> I suggest also run intensive test on Windows (run a bat file commiting
> and pushing to a bare directory type repository). Check your HDD
> healthy status after 10-20 run of 'git push'.
> 
> My git software is come form 'git-scm.com' and I'm using TortoiseGit.
> My git software is up to date.
> Last time my laptop HDD is crashed loosing sensitive datas. I will
> never push to a local repo I'm using online repo-s like github.
> 

Do you currently have a drive in the bad state? Is write-caching enabled 
for the drive 
(https://docs.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/turn-disk-write-caching-on-off)?

Git hammers the filesystem in a way that's not typically done for a USB 
drive (especially issuing some "FlushFileBuffers" calls).  So it 
possibly exposes some inherent flakiness in your setup. For instance, 
your drives might be good, but something could be wrong with your USB 
cable or the power supply.

If you have a drive in the bad state, a "chkdsk /scan /X <drive letter>" 
might give some hints about what specifically is wrong with that filesystem.

I'd recommend preferring a cloud-based backup system for your Git repos 
(e.g. GitHub or GitLab).  Also, for local backups, something solid-state 
like an SSD might be more reliable in the long run.

Thanks,
Neeraj