I've got a git repository on my file server which I'm connecting to via AFP. Whenever I try to do a git operation on the shared repository, such as staging a file, I get the following error message:
fatal: Unable to write new index file
If I execute the git command on the server it works fine, so there's something about sharing the repository via AFP that's not working.
I'm using Mountain Lion on both the server and the client.
UPDATE
I seem to have write permission for both .git
and .git/index
:
$ ls -ld .git
drwxr-xr-x 1 david staff 364 Nov 29 22:38 .git/
$ ls -l .git/index
-rw-r--r-- 1 david staff 2232 Nov 29 21:45 .git/index
$ cp .git/index backup
$ echo change >> .git/index
I tried recursively applying permissions to .git
as suggested by an answer below, but that didn't help:
$ chmod -Rv +w .git
$ git add deploy.js
fatal: Unable to write new index file
Hmm, it looks like someone else is using the index
file:
$ cp .git/index backup; mv backup .git/index
mv: rename backup to .git/index: Resource busy
But fuser
and lsof
aren't of any help:
$ fuser -fu .git/index
.git/index:
$ lsof .git/index
Weird workaround: If I do the following command on the server, it allows me to write a new index
file on the client over AFP.
$ cp .git/index backup; mv backup .git/index
I'm totally lost at this point; any new theories?