Need a web scraping or data wrangling solution? Check out my resume (PDF).
John Bokma's Hacking & Hiking

Git permission issue with VirtualBox shared folders

June 16, 2019

Last Friday I ran into an odd issue with git svn clone inside a shared folder of VirtualBox 6.0.8 with Ubuntu 19.04 the guest OS and MacOS Mojave the host:

error: insufficient permission for adding an object to repository database .git/
objects
fatal: git-write-tree: error building trees
write-tree: command returned error: 128

Because I had just to edit one file and commit it, I decided to let the repository be a Subversion one for the time being.

But then I had to create a new git repository, also inside a VirtualBox shared folder. This went well until I tried to add a file to it and was greeted with a similar error message:

error: insufficient permission for adding an object to repository database .git/
objects
error: hello.txt: failed to insert into database
error: unable to index file hello.txt
fatal: adding files failed

A minimal test case to reproduce this issue with VirtualBox 6.0.8 r130520 follows. Enter the following commands inside a shared folder on the guest:

mkdir hello && cd $_
git init
touch hello.txt
git add hello.txt

This was not the first time I bumped into an issue with shared folders. Back in 2017 I ran into an issue with cmake and also having MySQL database files in a shared folder resulted in my experience into issues.

However, I can't recall having problems with git on earlier versions of VirtualBox 5.x so this looks like a regression error.

The closest matching ticket I could find today is Ticket #18569 (new defect), to which I added my findings.