Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Git generally choke on mounted drives? Or just Git GUI's?

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.

like image 229
shennan Avatar asked Feb 28 '14 18:02

shennan


People also ask

Is there a GUI for Git?

Git comes with built-in GUI tools for committing (git-gui) and browsing (gitk), but there are several third-party tools for users looking for platform-specific experience.

Which of the following is not a git-gui client?

Magit. Magit is not a separate Git desktop client – it is a free plugin with an original text-based interface. It is implemented as a GNU Emacs package to use on Windows, Mac, and Linux. The plugin allows the developers to perform the necessary version control tasks directly in the Emacs window.

Is git desktop free?

By simply login in using your GitHub account, you can start working on your repositories. GitHub Desktop is a free and open source Git GUI client. It has an intuitive interface that allows you to manage code without you needing to type commands.


2 Answers

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.

like image 128
DasKrümelmonster Avatar answered Oct 06 '22 11:10

DasKrümelmonster


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

like image 1
Robert Ramey Avatar answered Oct 06 '22 13:10

Robert Ramey