hg在linux上的权限设定

1、建立hg账号:useradd hg

2、使用hg账号登录,进入目标工程test目录(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 -a -G hg foo

7、enjoy it!

 

总结:将开发者加入目标工程所在的组,并且设置关键目录的组权限。注意:由于后面setgid只针对3个hg系统目录,如果第二步中工程含有子目录,这些目录没有组操作权限。最佳实践是初始化一个只含有.hgignore文件的空项目,完成后添加其它文件。

参考官方文档: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).

你可能感兴趣的:(linux)