gitolite 添加用户和repo

http://gitolite.com/gitolite/admin.html

1 adding and removing repos

NOTE: this page describes how to add new repos. To bring already existing repos into gitolite control, click here.


WARNING: Do NOT add new repos or users manually on the server. Gitolite users, repos, and access rules are maintained by making changes to a special repo called 'gitolite-admin' and pushing those changes to the server.


Just as for users, all operations are in a clone of the gitolite-admin repo.

To add a new repo, edit conf/gitolite.conf and add it, along with at least one user with some permissions. Or add it to an existing repo line:

repo gitolite tsh gitpod
    RW+     =   sitaram
    RW  dev =   alice bob
    R       =   @all

The "repo" line can have any number of repo names or repo group names in it. However, it can only be one line; this will not work

repo foo
repo bar    # WRONG; 'foo' is now forgotten
    RW      =   alice

If you have too many, use a group name:

@myrepos    =   foo
@myrepos    =   bar

repo @myrepos
    RW      =   alice

Finally, you add, commit, and push this change. Gitolite will create a bare, empty, repo on the server that is ready to be cloned.

Removing a repo is not so straightforward. You certainly must remove the appropriate lines from the conf/gitolite.conf file, but gitolite will not automatically delete the repo from the server. You have to log on to the server and do the dirty deed yourself :-)

It is best to make the change in the conf file, push it, and then go to the server and do what you need to.

Renaming a repo is also not automatic. Here's what you do (and the order is important):

    • Go to the server and rename the repo at the Unix command line.
    • Change the name in the conf/gitolite.conf file and add/commit/push.

2 adding and removing users

Strictly speaking, gitolite doesn't know where users come from. If that surprises you, read this. However, gitolite does help with ssh-based authentication, so here's some info on adding and removing users.


WARNING: Do NOT add new repos or users manually on the server. Gitolite users, repos, and access rules are maintained by making changes to a special repo called 'gitolite-admin' and pushing those changes to the server.


All operations are in a clone of the gitolite-admin repo.

To add a user, say Alice, obtain her public key (typically $HOME/.ssh/id_rsa.pub on her workstation), copy it to keydir with the user name as the basename (e.g., 'alice.pub' for user alice), then git add keydir/alice.pub. (All keys files must have names ending in ".pub", and must be in openssh's default format).

To remove a user, git rm keydir/alice.pub.

In both cases, you must commit and push. On receiving the push, gitolite will carry out the changes specified.

The user name is simply the base name of the public key file name. So 'alice.pub', 'foo/alice.pub' and 'bar/alice.pub', all resolve to user "alice".

3 access control via the gitolite-admin repo

Most day-to-day administration of a gitolite site happens like this:

  • clone the gitolite-admin repo to your workstation
  • make appropriate changes
  • add, commit, and push

the conf/gitolite.conf file

Most of gitolite's power is in the conf/gitolite.conf file, which specifies detailed access control for repos. Everything except adding users happens from this file.

Here is an example of a simple conf/gitolite.conf file.

    @staff              =   dilbert alice           # line 1
    @projects           =   foo bar                 # line 2

    repo @projects baz                              # line 3
        RW+             =   @staff                  # line 4
        -       master  =   ashok                   # line 5
        RW              =   ashok                   # line 6
        R               =   wally                   # line 7

        config hooks.emailprefix = '[%GL_REPO] '    # line 8

Use the following links to learn more:

  • The basic syntax -- comments, whitespace, include files, etc.
  • Defining groups, as in lines 1 and 2.
  • Adding and removing users.
  • Adding and removing repos, as in line 3.
  • Defining access rules, as in lines 4, 5, 6, and 7.
  • Gitolite options.
  • Git config keys and values, as in line 8.
  • "Wild" repos -- ad hoc, user-created, repos.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值