SourceTree share folder index permission issue
Asked by hanoh haim:

ST version is 1.6.14.0.

When repo is on share NFS folder used by both linux and windows F5 from ST change .git/index to be

with +x

before

------------

\[csi-kiwi-02\]\> ll -a .git  
total 72K  
drwxr-xr-x 8 hhaim eng 4.0K Jul 3 18:30 .  
drwxr-xr-x 5 hhaim eng 8.0K Jul 3 17:35 ..  
drwxr-xr-x 2 hhaim eng 4.0K Jul 1 12:47 branches  
-rw-r--r-- 1 hhaim eng 5 Jul 3 17:50 COMMIT_EDITMSG  
-rwxr-xr-x 1 hhaim eng 661 Jul 3 17:10 config  
-rw-r--r-- 1 hhaim eng 73 Jul 1 12:47 description  
-rwxr-xr-x 1 hhaim eng 316 Jul 3 18:27 FETCH_HEAD  
-rw-r--r-- 1 hhaim eng 23 Jul 3 18:30 HEAD  
drwxr-xr-x 2 hhaim eng 4.0K Jul 1 12:47 hooks  
-rw-r--r-- 1 hhaim eng 5.5K Jul 3 18:30 index  
drwxr-xr-x 2 hhaim eng 4.0K Jul 1 12:47 info  
drwxr-xr-x 3 hhaim eng 4.0K Jul 1 12:47 logs  
drwxr-xr-x 122 hhaim eng 12K Jul 3 17:33 objects  
-rw-r--r-- 1 hhaim eng 41 Jul 3 17:07 ORIG_HEAD  
-rw-r--r-- 1 hhaim eng 107 Jul 1 12:47 packed-refs  
drwxr-xr-x 5 hhaim eng 4.0K Jul 1 12:47 refs  
-rwxr-xr-x 1 hhaim eng 863 Jul 3 18:26 sourcetreeconfig  
\[csi-kiwi-02\]\>

after

----------------------

\[csi-kiwi-02\]\> ll -a .git  
total 72K  
drwxr-xr-x 8 hhaim eng 4.0K Jul 3 18:28 .  
drwxr-xr-x 5 hhaim eng 8.0K Jul 3 17:35 ..  
drwxr-xr-x 2 hhaim eng 4.0K Jul 1 12:47 branches  
-rw-r--r-- 1 hhaim eng 5 Jul 3 17:50 COMMIT_EDITMSG  
-rwxr-xr-x 1 hhaim eng 661 Jul 3 17:10 config  
-rw-r--r-- 1 hhaim eng 73 Jul 1 12:47 description  
-rwxr-xr-x 1 hhaim eng 316 Jul 3 18:27 FETCH_HEAD  
-rw-r--r-- 1 hhaim eng 23 Jul 3 18:26 HEAD  
drwxr-xr-x 2 hhaim eng 4.0K Jul 1 12:47 hooks  
-rwxr-xr-x 1 hhaim eng 5.5K Jul 3 18:26 index \<\<=========================  
drwxr-xr-x 2 hhaim eng 4.0K Jul 1 12:47 info  
drwxr-xr-x 3 hhaim eng 4.0K Jul 1 12:47 logs  
drwxr-xr-x 122 hhaim eng 12K Jul 3 17:33 objects  
-rw-r--r-- 1 hhaim eng 41 Jul 3 17:07 ORIG_HEAD  
-rw-r--r-- 1 hhaim eng 107 Jul 1 12:47 packed-refs  
drwxr-xr-x 5 hhaim eng 4.0K Jul 1 12:47 refs  
-rwxr-xr-x 1 hhaim eng 863 Jul 3 18:26 sourcetreeconfig

now this create this issue from Linux

#\>git checkout master

error: Unable to create .git/HEAD

Already on 'master'  

so it seem ST write this file and Linux having trouble to work with it ..

thanks

Hanoh


Answers:
author: Seth
body: You should not use a Git repository over NFS. If your repository is on a remote server, you should clone it to your local machine, and push and pull from there.

comments: author: hanoh haim
body: Hi Seth, fast for the fast response.The all point is to use SourceTree on my local repo (merge/diff/tree view/commit etc)SourceTree support looking into remote repo (push/pull)my local is on NFS because I need to edit from windows and compile from Linux.Is there a way to work on local repo while both Linux and Windows can work as git clients without interfering etch other? git client on linux can work on NFS share folder it it is the only client.SourceTree can work on NFS share folder if it is the only client .both does not work ..


author: Seth
body: I would only use one of the clients. Since you are sharing over NFS, operations in one environment will effect the repository in both. I would recommend using the Windows local drive as the physical home for the repo, and only use the SourceTree client. Share your repo over NFS, but don't use a Linux git client, just the compile process.That recommendation won't be sufficient if the compile process issues git commands.


author: hanoh haim
body: This is strace when it worksrename(".git/index.lock", ".git/index") = 0lstat(".git/HEAD", {st_mode=S_IFREG\|0644, st_size=23, ...}) = 0open(".git/HEAD", O_RDONLY) = 3read(3, "ref: refs/heads/master\\n", 255) = 23read(3, "", 232) = 0close(3) = 0lstat(".git/refs/heads/master", {st_mode=S_IFREG\|0755, st_size=41, ...}) = 0open(".git/refs/heads/master", O_RDONLY) = 3read(3, "eba24acea45f09269b616b14b3d27bb5"..., 255) = 41read(3, "", 214) = 0close(3) = 0stat(".git", {st_mode=S_IFDIR\|0755, st_size=4096, ...}) = 0open(".git/HEAD.lock", O_WRONLY\|O_CREAT\|O_EXCL, 0666) = 3write(3, "ref: refs/heads/master\\n", 23) = 23close(3) = 0rename(".git/HEAD.lock", ".git/HEAD") = 0lstat(".git/refs/heads/master", {st_mode=S_IFREG\|0755, st_size=41, ...}) = 0open(".git/refs/heads/master", O_RDONLY) = 3read(3, "eba24acea45f09269b616b14b3d27bb5"..., 255) = 41read(3, "", 214) = 0close(3) = 0stat(".git", {st_mode=S_IFDIR\|0755, st_size=4096, ...}) = 0stat(".git/logs", {st_mode=S_IFDIR\|0755, st_size=4096, ...}) = 0open(".git/logs/HEAD", O_WRONLY\|O_CREAT\|O_APPEND, 0666) = 3close(3) = 0open(".git/logs/HEAD", O_WRONLY\|O_APPEND) = 3open("/etc/localtime", O_RDONLY\|O_CLOEXEC) = 4fstat(4, {st_mode=S_IFREG\|0644, st_size=9251, ...}) = 0fstat(4, {st_mode=S_IFREG\|0644, st_size=9251, ...}) = 0mmap(NULL, 4096, PROT_READ\|PROT_WRITE, MAP_PRIVATE\|MAP_ANONYMOUS, -1, 0) = 0x7fb964744000read(4, "TZif2\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\5\\0\\0\\0\\5\\0\\0\\0\\0"..., 4096) = 4096lseek(4, -3285, SEEK_CUR) = 811read(4, "TZif2\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\6\\0\\0\\0\\6\\0\\0\\0\\0"..., 4096) = 4096read(4, "\\325\\304\\257\\360\\0\\0\\0\\1\\326\\250\\321\\200\\0\\0\\0\\1\\327\\255\\314p\\0\\0\\0\\1\\330\\210\\263\\200\\0\\0\\0\\1"..., 4096) = 4096read(4, "\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2\\3\\2"..., 4096) = 248lseek(4, 9250, SEEK_SET) = 9250close(4) = 0munmap(0x7fb964744000, 4096) = 0write(3, "eba24acea45f09269b616b14b3d27bb5"..., 167) = 167


author: hanoh haim
body: fstat(3, {st_mode=S_IFREG\|0644, st_size=5608, ...}) = 0close(3) = 0rename(".git/index.lock", ".git/index") = 0lstat(".git/HEAD", {st_mode=S_IFREG\|0644, st_size=23, ...}) = 0open(".git/HEAD", O_RDONLY) = 3read(3, "ref: refs/heads/master\\n", 255) = 23read(3, "", 232) = 0close(3) = 0lstat(".git/refs/heads/master", {st_mode=S_IFREG\|0755, st_size=41, ...}) = 0open(".git/refs/heads/master", O_RDONLY) = 3read(3, "eba24acea45f09269b616b14b3d27bb5"..., 255) = 41read(3, "", 214) = 0close(3) = 0stat(".git", {st_mode=S_IFDIR\|0755, st_size=4096, ...}) = 0open(".git/HEAD.lock", O_WRONLY\|O_CREAT\|O_EXCL, 0666) = 3write(3, "ref: refs/heads/master\\n", 23) = 23close(3) = 0rename(".git/HEAD.lock", ".git/HEAD") = -1 EACCES (Permission denied)write(2, "error: Unable to create .git/HEA"..., 34error: Unable to create .git/HEADstrace from linux shows that there is lock file issue