Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I tried a couple different things. First, just setting the umask before cloning.

$ umask
0002

Files that I create are then writable by group

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

Now I try git clone

$ git clone [email protected]:user/repo.git
Cloning into repo... [succeeds]

But the clone directory not writable by group.

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

I tried the same thing with a repo created with git init --shared=umask (which should already be the default) in a directory with 775 permissions. After pushing to github git clone gets the same results.

This isn't a huge deal, I can chmod in my checkout scripts. But if there's a right/builtin way to do this, that's preferable. Git is version 1.7.4.1 on Ubuntu 11.04.

Any ideas or links are appreciated. I saw this post, but it uses chmod, I haven't been able to find much else on this. Thanks!

like image 782
r_2 Avatar asked May 17 '12 14:05

r_2


2 Answers

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

git -c "core.sharedRepository=group" clone [email protected]:user/repo.git
ls -ld repo/.git
drwxrwsr-x 8 user user 4096 Jul  4 22:16 repo/.git/
like image 129
fork0 Avatar answered Oct 14 '22 13:10

fork0


This was due to a bug, fixed in git >= v1.7.11.3

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

like image 21
IanB Avatar answered Oct 14 '22 13:10

IanB