本文介绍了sharedRepository错误的组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



建议使用 sharedRepository = true 告诉git给一组用户推送权限。



当我想添加推动者时,我只需将他们所需的组添加为辅助组( sudo adduser the_pusher the_required_group )



当开发人员推送时,我看到 objects

示例:

  $ ls -l存储库/对象
...
drwxrwsr-x 2 pusher1 pusher1 4096 janv。 7 14:13 fa
drwxrwsr-x 2 pusher1 pusher1 4096déc。 26 15:29 fc
drwxrwsr-x 2 pusher1 pusher1 4096déc。 11 12:41 fd
...

正如您所见,附加组是主要组 pusher1



如何让git将这些对象附加到 the_required_group

更新 $ b $ b

我通过ssh使用git。
每个开发者都有自己的ssh帐户。

解决方案

我的团队通过设置 ch chown 和 chgrp 将文件和目录复制到正确的用户/组,然后 chmod g + s 存储库中的所有内容。



+ s 会导致新文件拥有其父目录的组。取自 man 2 chown

另见 man chmod 和 man 2 chmod


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

See also, man chmod and man 2 chmod

这篇关于sharedRepository错误的组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:49