简体   繁体   English

Git:服务器上多个用户的repo

[英]Git: repo for multiple users on a server

I created a Git repo on a server and want it to be used by several people, ie users which belong to the same Unix group. 我在服务器上创建了一个Git repo,并希望它被几个人使用,即属于同一个Unix组的用户。 It also has a working copy because it may be useful for us to have a common working copy. 它还有一个工作副本,因为我们可能有一个共同的工作副本。

Thus I set the owning group of that Git repo directory to that Unix group. 因此,我将该Git repo目录的拥有组设置为该Unix组。

The problem is, every time someone is pushing to that repository, the new files/directories have the owner set to the username of that user and his group but not our common group. 问题是,每当有人推送到该存储库时,新文件/目录都将所有者设置为该用户及其组的用户名,而不是我们的公共组。 Also, all those new files/directories become rwxr-xr-x . 此外,所有这些新文件/目录都变为rwxr-xr-x

I tried git config core.sharedRepository group but that doesn't really work. 我尝试了git config core.sharedRepository group但这并没有真正起作用。 It now makes files/directories as rwxrwsr-x but is has still the wrong group set. 它现在使文件/目录为rwxrwsr-x但仍然是错误的组集。

Ok, figured it out. 好吧,想通了。

The first important thing (which I did already) was: 第一件重要的事情(我已经做过)是:

git config core.sharedRepository group

The second one was this: 第二个是这个:

chmod g+s -R .

I would highly recommend you use gitolite for any rights management within an organization and git. 我强烈建议您使用gitolite进行组织内的任何权限管理和git。 This has made management of the repos so much easier. 这使得回购管理变得更加容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM