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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With