Committing to Git on VirtualBox - error: unable to write sha1 filename
I am working on a project that requires me to run Ubuntu as a dev server on VirtualBox from my main Windows machine. I have a common shared folder between Windows and Ubuntu VBox. The project is built in Yii PHP, and I work mostly on the front-end code. Git is installed on Ubuntu and I am able to successfully pull from the project's github repository. However, the problem lies when I try to commit to git.
When I type the command "git add -A", I get the following error:
error: unable to write sha1 filename .git/objects/e6/54703eed28d60e6f607eda24ffd2048bca83a6: Text file busy error: framework/i18n/data/ne_np.php: failed to insert into database error: unable to index file framework/i18n/data/ne_np.php fatal: updating files failed
I have tried many work-arounds, including the command:
git config --add core.shareRepository group
But I also end up with a similar error.
Does anyone have any idea of what could be causing this? Thanks.
Using git in synchronised folders like Dropbox or this is generally a bad idea – git seems to assume that nobody else tries to touch a repo concurrently, doesn't try to perform sets of filesystem operations atomically, and you get race conditions like this.
Don't put git repos into automatically synced folders. Synchronise the host and the VM by pushing/pulling to your github fork.
Do not try to share your repository. Do a clean checkout on the VM and Windows host. Git is not designed to be shared like this.