Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git over samba - unable to write sha1 filename | Permission denied

When I am using git over samba share on windows I get an error when i want to commit a file via git_extentions or tortoiseGIT. The error is: error: unable to write sha1 filename .git/objects/b4/e819f886bf31b67c42249a0eff8e8b16cf7622: Permission denied. When I add the file via the ubuntu server and commit the file it works fine. I am also working in a banrch.

I have already tryed chmod 777 the whole .git folder.

like image 979
InfoTracer Avatar asked Sep 30 '10 09:09

InfoTracer


3 Answers

I've seen this, too. It's a git defect, likely to do with how it creates and modifies files. To clarify the problem:

# mount a samba share locally. 
$ mount -t cifs options //share/project  /mnt/project

# The share contains a git checkout.
# Do some typical development.
$ cd /mnt/project
$ vi file    ## ok
$ git pull   ## ok
$ git status ## ok
$ git add file ## error!
  error: unable to create temporary sha1 filename 
  .git/objects/8b/tmp_obj_mYE1Xi: Permission denied


## But everything from the shell seems to work.
$ ls -latr .git/objects/8b/  ## ok. empty dir.
$ touch .git/objects/8b/tmp_obj_mYE1Xi ## ok.
$ echo test123> .git/objects/8b/tmp_obj_mYE1Xi ## ok.
$ cat  .git/objects/8b/tmp_obj_mYE1Xi  ## ok.
test123
$ rm  .git/objects/8b/tmp_obj_mYE1Xi  ## ok.

In git version 1.5.6.5 (latest Debian package), you get the error when you try to git-add. If you install git 1.7.3.2 (latest release), you can add the file, but you will get the error when you attempt to commit.

like image 151
john Avatar answered Nov 20 '22 08:11

john


This issue has been seen before in some form or another for Git/Samba installations. Not sure if the source of the problem has been pin pointed yet:

http://code.google.com/p/msysgit/issues/detail?id=130#makechanges

Update:

looks like git v. 1.7.3.3 has resolved this issue.

like image 31
dkinzer Avatar answered Nov 20 '22 10:11

dkinzer


Ok, I have found a solution that worked for me.

I have been using git over samba (samba-common-3.0.33-3.7.el5) for ages with no problems.

I upgraded git to Git-1.7.6-preview20110708, and it all went to pot!

As Im such a methodical developer, I didnt write down what I upgraded from!

So I went through the list of previous releases and saw a Star next to Git-1.7.0.2-preview20100309, so a bit old, but put that on.... and bang... it works!

like image 3
Ian Vaughan Avatar answered Nov 20 '22 09:11

Ian Vaughan