3

When I work with git on Windows 10 I never get this problem. But when I work with git in Ubuntu VM using VirtualBox it happens pretty often and it is really annoying. I know there is an answer for that, but is there any long term fix for that so it doesn't happen at all?

I have tried initializing another git repo and then pushing it to that new repo but that doesn't work.

It says something like this:

error: object file .git/objects/cf/... is empty
error: object file .git/objects/cf/... is empty
fatal: loose object ... (stored in .git/object/cf/...) is corrupt

I expect it to commit changes when I do git add . and git commit -m "foo". But it gives that error pretty often.

  • You might be interested in the second answer on this question: https://stackoverflow.com/questions/4254389/git-corrupt-loose-object – Mike Faber Apr 01 '19 at 16:19
  • 3
    If you're using a VirtualBox "shared folder", stop. Use a private-to-the-VM (pseudo) disk. Shared folders just don't work reliably. – torek Apr 01 '19 at 17:56
  • There it is. I was thinking forced shutdowns and filesystems configured to assume some power-out protection, but shared folder seems much more likely. – jthill Apr 01 '19 at 17:58
  • @torek can you give me some links on how to do that please? – Luka Pavicic Apr 02 '19 at 20:27
  • I don't use Windows but when I set up a VM on MacOS, the VM has some shared folders and some private ones. I just make sure I put all my "real work" repositories in the private ones. I do have a few in shared folders but I don't work in them as they flake out. – torek Apr 02 '19 at 21:53
  • @torek i am not using shared folders in my VM, but I am still facing this issue. – Amruta Deshmukh Feb 24 '21 at 19:35
  • @LukaPavicic did you find the cause for the issue – Amruta Deshmukh Feb 24 '21 at 19:36

0 Answers0