I know I should be diehard and use git in the terminal, but I use a Git client on Mac called Sourcetree to make the whole thing just a bit more sexy.
The problem is a new Synology NAS drive I've added to my setup. With one of the NAS shared folders mounted on my Mac, Sourcetree chokes when trying to stage/commit/push.
My master branch is on GitHub, so I cloned a repo to the mounted drive using Sourcetree. As a quick test I edited an unimportant file, saved, and watched for unstaged changes in the client. Success so far; the edited file appears in the unstaged window of Sourcetree. I go to stage it. Fatal error:
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree add -f -- README.md
fatal: Unable to write new index file
Completed with errors, see above
I had a look at the file permissions of the index file within the hidden .git
folder (using the NAS directory explorer as the Mac doesn't show the hidden file. The file permissions were reading, writing, but not executing. After allowing execution of the file, the stage/commit/push attempts with Sourcetree worked.
Obviously, I don't want to have to go and manually adjust file permissions every time I clone a git repository, so does anybody have any insight as to why Sourcetree/Git is not creating the repo clone with more helpful file permissions?
For the record, I tried the same operation with the GitHub OSX client, which seemed successful (no need to edit permissions). But I find the GitHub client a little primitive, and would prefer to use Sourcetree.
It is git in general. This answer suggests, it is because of the filelocking. For more info, just search SO for "git samba"
From my experience, operating on a non-bare repo on a network drive is a bad idea.
For best-practises: http://git-scm.com/book/ch4-1.html
So either:
In any case it is recommended that the git repo with the working copy resides on a local disk.