日期:2014-05-16  浏览次数:20826 次

hg在linux上的权限设定

1、建立hg账号:useradd hg

2、使用hg账号登录,进入目标工程test目录,初始化工程:hg init

3、更改关键三个目录组写权限:chmod g+w .hg .hg/* .hg/store/

4、更改关键三个目录组设置(setgid):chmod g+s .hg .hg/store .hg/store/data

5、新建开发者账号:useradd -m foo

6、把新建的开发者加入hg组:usermod -G hg foo

7、enjoy it!

?

总结:将开发者加入目标工程所在的组,并且设置关键目录的组权限。

参考官方文档:http://mercurial.selenic.com/wiki/MultipleCommitters之The filesystem method,摘录如下:

?

The idea here is to create a repository that is accessible by members of a certain user group. Multiple users will be able to access it if they belong to this group.

The following steps apply to Unix-like operating systems:

  1. Add a new group to /etc/group. The recommended method for accomplishing this varies from system to system, but the end result is a new line in /etc/group like the following:

    project:x:100001:alice,bob,charlie

    Here, project is the name of the group.

  2. Create a repository that's writable by that group:
    mkdir /home/mercurial/project
    cd /home/mercurial/project
    hg init
    chgrp project .hg .hg/* .hg/store/*
    chmod g+w .hg .hg/* .hg/store/*
    chmod g+s .hg .hg/store .hg/store/data
    • The chgrp command marks the project as belonging to the project group.

    • The first chmod command marks the repository data writable by that group.

    • Finally, the second chmod command sets the 'setgid' bit on the project directories, which causes new files created in those directories to be marked as belonging to that group (rather than the user's default group).