Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prevent my git from corrupting?

I am working off of VMWare's virtual ubuntu 16.04 environment on an android studio project. The git is set up normally and works most of the time but I occasionally (at least three times in the past two months) get a corrupted git.

error: object file .git/objects/bb/2b004268181780ddea02ea4313142fc36a0541 is empty
error: object file .git/objects/bb/2b004268181780ddea02ea4313142fc36a0541 is empty
fatal: loose object bb2b004268181780ddea02ea4313142fc36a0541 (stored in .git/objects/bb/2b004268181780ddea02ea4313142fc36a0541) is corrupt

I am not asking how to fix those errors, I've already fixed them a couple times but they keep happening and it's really annoying and time consuming to fix. What is causing this to happen?

My normal day with git is to open VMWare, log into my virtual machine, and open up android studio, I don't touch git until the end of the day. I end the day one of two ways.

  1. I click File -> Exit on Android Studio, git commit stuff, then close VMWare. Then I shut down the desktop.
  2. Same as 1 except I leave VMWare open, I don't git commit that day, Ctrl-alt-del and set the desktop to locked mode.

Or some variation of the two.

I usually encounter the corruption at the end of the day when I try to commit.

Hard Disk Settings

Additional VMWare settings:

  • Hardware settings of my virtual machine
  • Virtual machine options
like image 509
CookieMonster Avatar asked Sep 06 '16 20:09

CookieMonster


People also ask

How does git ensure data integrity?

Assuming the contents are valid, they contain a (single) tree ID (plus information about the commit: who made it, when, its parents, and so on). Git then extracts the tree contents by ID, and compares the checksum of the contents to the ID. This must match, or the tree contents are corrupted.


1 Answers

For those having the problem and disk size is not the issue this may help: I was powering down my machine and I kept getting git repo errors (I also noticed multiple journal recoveries on start up). I then tried Sending the Shutdown signal via the File menu; it indicated I had open files. I suspect the Shutdown allowed those files to close; I suspect some of them were git repo files.

That got rid of the journaling errors and so far I have not seen any git repo errors. Probably better is the ACPI Shutdown menu option under the Machine menu.

like image 62
G Hall Avatar answered Oct 22 '22 17:10

G Hall