'git clone' respects umask, except for the top-level project directory

I would like to clone a git project (from github, say) and have a top level directory writable by the group.

I tried a couple of different things. First, just install umask before cloning.

$ umask 0002 

The files I create are then written by the group

 $ touch test $ ls -l test -rw-rw-r-- 1 user group 0 2012-05-17 09:32 test 

Now i will try git clone

 $ git clone git@github.com:user/repo.git Cloning into repo... [succeeds] 

But the clone directory is not writable by the group.

 $ ls -ld repo drwxr-xr-x 11 user group 4096 2012-05-17 09:32 repo 

I tried the same with a repo created using git init --shared=umask (which should already have been by default) in a directory with 775 permissions. After clicking on github git clone , the same results are obtained.

This is not a huge deal, I can chmod in my validation scripts. But if there is a proper / built-in way to do this, this is preferable. git - version 1.7.4.1 on Ubuntu 11.04.

Any ideas or links are appreciated. I saw this post, but it uses chmod , I have not yet been able to find something else. Thanks!

+8
git linux permissions
source share
2 answers

Try setting the global "core.sharedRepository = group" for the clone command only:

 git -c "core.sharedRepository=group" clone git@github.com:user/repo.git ls -ld repo/.git drwxrwsr-x 8 user user 4096 Jul 4 22:16 repo/.git/ 
+2
source share

This was due to an error fixed in git> = v1.7.11.3

See: https://github.com/git/git/commit/45d4fdc2dc74c657a9c2e95bf04aed539fdcb0a4

0
source share

All Articles