Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sharedRepository wrong group

I use a bare repository where multiple devs can push.

As suggested, I used sharedRepository = true to tell git to give a group of users the permission to push.

When I want to add pushers, I simply add them the required group as secondary group (sudo adduser the_pusher the_required_group)

When devs push, I see the files created in objects directory created with the good permission but not the good group.

Example:

$ ls -l repository/objects
...
drwxrwsr-x 2 pusher1 pusher1 4096 janv.  7 14:13 fa
drwxrwsr-x 2 pusher1 pusher1 4096 déc.  26 15:29 fc
drwxrwsr-x 2 pusher1 pusher1 4096 déc.  11 12:41 fd
...

As you can see, the attached group is the primary group of pusher1

How can I make git to attach these objects to the_required_group instead ?


Update

I use git over ssh. Each dev have his own ssh account.

like image 688
Pierre de LESPINAY Avatar asked Oct 21 '22 20:10

Pierre de LESPINAY


1 Answers

My team has fixed this by setting the s option on all directories in the repository with chmod To do this chown and chgrp the files and directories to the correct user/group then chmod g+s everything in the repository.

The +s causes new files to have the group of their parent directory. Taken from man 2 chown

  • If the file system is mounted with -o nogrpid and the set-group-ID bit is enabled on the parent directory, then the group of a new file is made the same as that of the parent directory.

See also, man chmod and man 2 chmod

like image 140
asm Avatar answered Oct 27 '22 11:10

asm