【问题标题】:Mercurial - How to restrict read access of user A to project B?Mercurial - 如何限制用户 A 对项目 B 的读取访问权限?
【发布时间】:2026-02-04 18:10:01
【问题描述】:

根据documentation

<Location /hg>
    AuthType Basic
    AuthName "Mercurial repositories"
    AuthUserFile /home/user/hg/hgusers
    Require valid-user
</Location>

这将允许经过身份验证的用户读取/推送 /var/hg/repos 中的所有项目。

到目前为止一切顺利。但是如何限制用户 A 读取/推送到项目 B?

【问题讨论】:

  • 您是否尝试过更具体的位置和 AuthGroupFile?

标签: mercurial tortoisehg


【解决方案1】:

您可以使用AclExtension 拒绝推送权限,我不知道读取的权限。

输入类似:

[hooks]
  pretxnchangegroup.acl = python:hgext.acl.hook
[acl]
  sources = serve
[acl.deny.branches] 
  * = A # deny access for user A to all branches

在 B 存储库的.hgrc 中。

如果您也想拒绝读取访问,您还可以在 Apache 中为该特定存储库配置特定的 &lt;location&gt;,其中不包含不需要的用户。

【讨论】:

    最近更新 更多