# git init --bare --shared does not set group for some files/dirs

2 messages from 2010-07-18 to 2010-07-18. Participants: Ville Skyttä, Ilari Liusvaara.
Thread: https://gitlist.dev/t/24428

## Ville Skyttä, 2010-07-18 10:14

Subject: git init --bare --shared does not set group for some files/dirs
Message-ID: <201007181314.41894.ville.skytta@iki.fi>
URL: https://gitlist.dev/e/201007181314.41894.ville.skytta%40iki.fi

```
Hello,

git init --bare --shared does not set the group for some files.  See below; it 
did set g+s for all dirs, and did set the group for the root dir, config, 
HEAD, and objects, but failed to set group for branches, description, hooks, 
info, and refs.  I discussed/reproduced this on #git today with drizzd and was 
instructed to post here.

In particular, I hit a problem with this and the refs dir; members of the 
desired group (gituser in my example) can not write into it.  I can obviously 
fix this locally with chgrp, but for which files/dirs should the gituser group 
be set, and are there some files/dirs that it is intentionally not set?

# git --version
git version 1.7.1.1
# groupadd gituser
# mkdir foo
# chgrp gituser foo
# cd foo
# git init --bare --shared
Initialized empty shared Git repository in /tmp/foo/
# ls -ld . *
drwxrwsr-x 7 root gituser 4096 Jul 18 13:05 .
drwxrwsr-x 2 root root    4096 Jul 18 13:05 branches
-rw-rw-r-- 1 root gituser  126 Jul 18 13:05 config
-rw-rw-r-- 1 root root      73 Jul 18 13:05 description
-rw-rw-r-- 1 root gituser   23 Jul 18 13:05 HEAD
drwxrwsr-x 2 root root    4096 Jul 18 13:05 hooks
drwxrwsr-x 2 root root    4096 Jul 18 13:05 info
drwxrwsr-x 4 root gituser 4096 Jul 18 13:05 objects
drwxrwsr-x 4 root root    4096 Jul 18 13:05 refs

```

## Ilari Liusvaara, 2010-07-18 12:08

Subject: Re: git init --bare --shared does not set group for some files/dirs
Message-ID: <20100718120820.GA20761@LK-Perkele-V2.elisa-laajakaista.fi>
URL: https://gitlist.dev/e/20100718120820.GA20761%40LK-Perkele-V2.elisa-laajakaista.fi
In-Reply-To: <201007181314.41894.ville.skytta@iki.fi>

```
On Sun, Jul 18, 2010 at 01:14:41PM +0300, Ville Skyttä wrote:
> Hello,
> 
> git init --bare --shared does not set the group for some files.  See below; it 
> did set g+s for all dirs, and did set the group for the root dir, config, 
> HEAD, and objects, but failed to set group for branches, description, hooks, 
> info, and refs.  I discussed/reproduced this on #git today with drizzd and was 
> instructed to post here.
> 
> In particular, I hit a problem with this and the refs dir; members of the 
> desired group (gituser in my example) can not write into it.  I can obviously 
> fix this locally with chgrp, but for which files/dirs should the gituser group 
> be set, and are there some files/dirs that it is intentionally not set?

AFAIK, there are none that intentionally don't have it (at least usually every
file and directory there has the repository group as owner). The usual quick
and dirty rules are:

- For fetching, +r for all regular files, +rx for all directories.
- For pushing, +r for all regular files (but +rw for regular files under
/logs/ if any), +rwx for all directories.

BTW: '/branches/' is used by pre-1.5 remotes stuff and pretty much totally
obsolete.

-Ilari

```
