gpt4 book ai didi

Gitolite 权限仅对一个分支

转载 作者:太空狗 更新时间:2023-10-29 14:12:45 31 4
gpt4 key购买 nike

我对 gitolite 有点困惑权限。

仅允许 1 个分支并拒绝特定用户或组的所有其他分支的最佳方法是什么?

最佳答案

参见“partial-copy: selective read control for branches

重点是:

Git (and therefore gitolite) cannot do selective read control -- allowing someone to read branch A but not branch B.
It's the entire repo or nothing.

Gerrit Code Review can do that, but that is because they have their own git (as well as their own sshd, and so on). If code review is part of your access control decision, you really should consider Gerrit anyway.

当您询问时得到的标准答案是“使用单独的存储库”(其中一个包含所有分支,一个包含分支的子集)。
这在理论上很好,但在实践中,当人们可能同时推送两个存储库时,您需要弄清楚如何使它们保持同步。

Gitolite 现在可以帮助您做到这一点。请注意,这仅适用于分支机构;您不能对文件和目录执行此操作。

方法如下:

  • 在 rc 文件的 ENABLE 列表中启用“partial-copy”。

  • 对于每个 repo“foo”,它有一组特定开发人员的 secret 分支(我们将使用一个名为 @temp-emp 的组作为例如)不应该看到,这样做:

     repo foo
    # rules should allow @temp-emp NO ACCESS

    repo foo-partialcopy-1
    - secret-branch = @temp-emp

    # other rules; see notes below

    - VREF/partial-copy = @all
    config gitolite.partialCopyOf = foo

重要提示:

  • 如果您使用其他 VREF,请确保将此 VREF 放在最后,在所有其他 VREF 之后。
  • 请记住,允许对部分复制存储库进行的任何更改都会传播到主存储库,因此请确保您使用其他规则来根据需要限制对其他分支和标签的推送。

关于Gitolite 权限仅对一个分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31919922/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com