Mercurial 更新时重置组权限
我已经根据此处描述的文档配置了我的 hg 存储库: 多个提交者。
但是,当我执行“hg update -C”在本地重新创建工作副本时,文件权限已更改,因此当其他开发人员尝试提交更改时,最终会导致推送错误。据推测,如果配置正确,hg update 将保留文件权限。但它似乎并没有这样做:
-rwxrwxr-x 1 root mercurial 2948 2010-06-24 15:27 .hg/store/data/src/public/index.php.i
对比(实际源文件,删除工作副本并使用“hg update -C”重新创建后)
-rw-r--r-- 1 root mercurial 820 2010-06-28 12:07 src/public/index.php
如何配置mercurial,以便当用户创建新文件或修改现有文件时,组及其权限是否保留?
更新
2010.06.28
以下是我看到的错误示例:
remote: resolving manifests
remote: getting src/configs/application.ini
remote: abort: Permission denied: /hg/repo/path/src/configs/application.ini
remote: warning: changegroup hook exited with status 255
remote: calling hook changegroup.notify: hgext.notify.hook
I've configured my hg repository according to the docs described here:
MultipleCommitters.
However, when I execute "hg update -C" to recreate the working copy locally, the file permissions have changed such that it eventually causes errors on push when other developers attempt to commit changes. Supposidly, when configured properly, hg update will preserve file permissions. Yet it doesn't appear to be doing so:
-rwxrwxr-x 1 root mercurial 2948 2010-06-24 15:27 .hg/store/data/src/public/index.php.i
vs. (actual source file, after deleting the working copy and recreating with "hg update -C")
-rw-r--r-- 1 root mercurial 820 2010-06-28 12:07 src/public/index.php
How can mercurial be configured such that when users create new files or modify existing files, the group and it's permissions are preserved?
UPDATE
2010.06.28
Here is a sample of the errors I'm seeing:
remote: resolving manifests
remote: getting src/configs/application.ini
remote: abort: Permission denied: /hg/repo/path/src/configs/application.ini
remote: warning: changegroup hook exited with status 255
remote: calling hook changegroup.notify: hgext.notify.hook
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题,并通过在远程存储库目录上设置粘性位解决了它。
这将解决OP遇到的问题。
I had this same problem and solved it by setting the sticky bit on the remote repo directory.
That will solve the problem that the OP ran into.
您具体使用了哪种方法?详细描述您的设置是什么。
是的,mercurial 确实会记住提交时的文件权限。当您执行
hg update -C
时,它将重新创建具有上次提交时设置的权限的文件。您的错误消息似乎表明存储库服务器上的存储库文件具有错误的权限/所有者,因此您无法使用 hg Push 修改它们。这可能是因为有人以不同的存储库服务器用户身份提交和推送文件。
我推荐共享 ssh 方法( https://www.mercurial-scm.org/wiki/SharedSSH ):您为存储库管理设置单独的用户帐户,添加开发人员的 ssh 公钥(您应该将它们限制为仅与特定存储库的 Mercurial 一起使用),然后使用 ssh://hguser@server/ path/to/repository 作为 url。
顺便说一句:默认情况下,如果用于推/拉的用户不在受信任列表中,则 Mercurial 不会运行任何挂钩。请参阅
man hgrc
中的可信部分。BTW2:不要以 root 身份运行任何常规软件。使用普通帐户即可。
Which method exactly you've used? Describe more what is your setup.
Yes, mercurial does remember file permissions on commit. When you do
hg update -C
, it will recreate files with permissions that were set on last commit.Your error message seems to be telling that repository files on repository server have wrong permissions/owner, so you cannot modify them with hg push. This could be because someone commited and pushed files as a different repository server user.
I would reccomend shared ssh method ( https://www.mercurial-scm.org/wiki/SharedSSH ): you set up separate user account for repository management, add developer's ssh public keys (you should restrict them to be used only with mercurial with specific repositories) and then use
ssh://hguser@server/path/to/repository
as an url.BTW: by default mercurial doesn't run any hooks if a user used to do push/pull is not in trusted list. See trusted section in
man hgrc
.BTW2: don't run any regular software as a root. use normal account for that.