Domanda

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.

È stato utile?

Soluzione

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:

  1. Setup an SSH server on you NAS and push/pull to that
  2. Map your network share (as you have now) but put a bare repo on that. Then, push/pull to that one.

In any case it is recommended that the git repo with the working copy resides on a local disk.

Altri suggerimenti

After a lot of wasted time I've come to the following solution:

On the Synology NAS server:

control panel -> File Sharing and Priviledges -> Win/Mac/NFS -> Mac File Service -> Apply Default Unix Permissions - Check this box and restart the file service.

Red herrings - stuff I tried an it didn't work.

a) change the Git set up from using the NAS system directly to using Git Server via ssh. b) using/not using Sourcetree for git access c) probably a dozen other things.

Note that the problem is not related to the Git setup but rather to the location of the directory where the check out occurs. without checking the box above, I couldn't change permissions or ownership on the index file even through the Terminal - though I should do it through SSH.

Robert Ramey

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top