简体   繁体   English

配置GitLab以在个人目录中存储每个用户的存储库

[英]Configuring GitLab to store repositories for each user in personal directory

Just installed GitLab , it works perfectly with one exception: It stores repositories for all users in one directory by default, and if two users independently would try to create project with the same name, for example, "test", the second user will receive failure like "path already been taken". 刚刚安装了GitLab ,它完美地运行了一个例外:默认情况下,它将所有用户的存储库存储在一个目录中,如果两个用户独立尝试创建具有相同名称的项目,例如“test”,则第二个用户将收到失败就像“路径已被采取”。

The basic approach to isolate repositories of each user is to have them inside subfolders with username, just like GitHub does. 隔离每个用户的存储库的基本方法是将它们放在具有用户名的子文件夹中,就像GitHub一样。 But I have no idea how to do that. 但我不知道该怎么做。

I know GitLab uses Gitolite to manage repositories, and the last one have a feature that should allow it: it is named "wildcard users", in gitolite.conf it looks like this: 我知道GitLab使用Gitolite来管理存储库,最后一个有一个应该允许它的功能:它被命名为“通配符用户”,在gitolite.conf中它看起来像这样:

@wildcard_users = user1 user2 user3
repo    CREATOR/.*
    C     = @wildcard_users
    CRW+D = CREATOR
    RW    = WRITERS
    R     = READERS

This way we see CREATOR in repo path, which will be replaced with user name created repository. 这样我们在repo路径中看到CREATOR,它将被用户名创建的存储库替换。 But the only way I see I could use this feature is to manually admin gitolite using a clone of gitolite-admin.git repository, and that kills the whole idea of GitLab where all things like this should be allowed through web interface. 但我看到我可以使用此功能的唯一方法是使用gitolite-admin.git存储库的克隆来手动管理gitolite,并且这会杀死GitLab的整个想法,其中所有这些都应该通过Web界面允许。

The exact Gitolite feature covering that need is called " wild repos ", and it is based on the user creating the repo (so, not GitLab ) 覆盖该需求的确切Gitolite功能称为“ 野生回购 ”,它基于用户创建回购(因此,不是GitLab

just create a new repo, as user "u4" (a student): 只需创建一个新的仓库,作为用户“u4”(学生):

$ git clone git@server:assignments/u4/a12
Initialized empty Git repository in /home/sitaram/a12/.git/
Initialized empty Git repository in /home/git/repositories/assignments/u4/a12.git/
warning: You appear to have cloned an empty repository.

Notice the two empty repo inits, and the order in which they occur ;-) 注意两个空的repo inits,以及它们发生的顺序;-)

GitLab doesn't support that workflow, and would need some large patch in order to manage repos which aren't directly under the repositories directory. GitLab不支持该工作流程,并且需要一些大型补丁才能管理不直接位于repositories目录下的repos。

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

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