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
soption on all directories in the repository withchmodTo do thischownandchgrpthe files and directories to the correct user/group thenchmod g+severything in the repository.The
+scauses new files to have the group of their parent directory. Taken fromman 2 chownSee also,
man chmodandman 2 chmod