Hi, I am running a Meteor/React/Apollo stack, and I have 2 private repository containing all these files for 2 different projects using the same stack. I’m running Fedora 34 and git version 2.31.1.
I have an extremely peculiar situation going on and I can’t figure out what’s causing it. These 2 repositories constantly become corrupted/broken.
I’m currently only working on these 2 projects and as such do not have long term experience dealing with any other repositories.
I use my command line, no GUI, and the only git commands I use are:
git add . git commit -m "some message" git push
In that same directory, I only ever run two other commands,
meteor to start the Meteor/MongoDB server, and
robo3t to access a GUI to interact with the Mongo server.
The IDE I use is VS Code. Since I’m working alone, my typical workflow is I push my day’s changes at the end of the day.
I’ve faced a slew of errors with the repositories:
- git corrupt loose object (there is a SO link but I can’t link it as I’m limited to 2 links in a post)
- fatal could not parse HEAD
- error: object file is empty (9/10 times this is the error)
Error #3 occurs the most. The first 2/3 times it happened I diligently followed the StackOverflow answers and fixed the repository. Now I’ve given up on constantly fixing the repository. I move my files out, clone my repository from GitHub, and copy/replace the files back in. This is MUCH faster.
Here’s why it’s extremely weird that these corruptions keep happening:
- Nothing else on my computer interacts with git. No other programs, GUIs, only when I interact with git in my terminal.
- I do not personally edit any of the git object files, as I have no reason to.
- I cannot predict when this happens. As I described above, I pull from my healthy GitHub repository, copy/replace all my new files in, and I can add, commit and push with no issues. The next day, at the end of the day it could become corrupted even though I never interacted with git for the entire day until I’m ready to push.
- I have never interrupted a git commit/push by shutting down the machine midway. I always cleanly exit the terminal after the push is successful.
- I’ve looked through all my processes running at multiple times of the day and nothing seems out of place as malicious or anything of that sort.
- My repository is simple, I only have 1 master branch and I am the only contributor to the repository. As mentioned, it’s a private repository.
- It is worth noting that none of my actual files get/are corrupted. Only some git object files.
The only edits I’ve ever done was to change all the authoring history to be under my GitHub account/email as this information wasn’t supplied earlier. And I’ve moved to using SSH for commits instead of HTTPS to avoid authentication every time. These issues persisted both before and after these changes, so they had no noticeable effect.
If anyone is able to give a modicum of advice on how I should go about figuring out what’s causing this, I’d be eternally grateful. It’s a complete pain having to constantly move my files and clone and copy/replace, etc.