我有一个主要的mercurial存储库(A),在Windows机器中有2个文件夹"depot1"和"depot2"
以下配置在A repo的.hg/hgrc文件中完成.
[ui]
username = praveen
[extensions]
hgext.acl=
[hooks]
changegroup.update = hg update
pretxnchangegroup.acl = python:hgext.acl.hook
[acl]
sources = serve push pull commit
Run Code Online (Sandbox Code Playgroud)
然后我创建了2个mercurial A库的克隆.Windows机器上的X和Y.
X .hg/hgrc文件是:
[ui]
username = clone1
Run Code Online (Sandbox Code Playgroud)
Y .hg/hgrc文件是:
[ui]
username = clone2
My Question:
1- Restrict all push operations from user="clone2".
2- user="clone1" will be able to perform push on only "depot1".
Run Code Online (Sandbox Code Playgroud)
请建议我如何配置这种配置.
谢谢,
普利文
不幸的是,你误解了username该[ui]部分的内容.它严格地是一个客户端设置,上面写着"如果服务器要求我提供用于身份验证的用户名,那就是我要发送的内容",那么你ui.username在repos A,X和Y中所拥有的内容对于什么是远程用户都没有影响可以和这些存储库一起使用.
相反,您需要使用Y和X存储库文件中的[acl.allow]和[acl.deny]部分.hg/hgrc来指定它们的访问控制.
您在示例中使用的用户名('clone1'和'clone2')也需要由真实的身份验证系统支持.内置的hg-serve不提供一个,所以你需要使用带有hgweb或hgwebdir的ssh或Apache/ISS.有关概述,请参阅发布存储库Wiki页面.