使用 Mercurial 设置文件所有权
我正在使用 Mercurial 作为工作流程的一部分,并且运行良好。不过我有一个棘手的问题。当我从中央存储库拉取到 Linux Web 服务器以进行升级时,我是使用“root”用户进行的。这似乎将任何新文件或更改的文件的所有者和组分配给“root”。
不幸的是,我遇到了其他困难,所以我总是必须检查所有文件并将其重置为正确的组和所有者(网络服务器上的非根用户)。
有没有办法让 Mercurial 自动执行此操作,或者有人有快速的方法来执行此操作?我正在使用 shell,并且必须输入,
chown -R username /home/username
我尝试使用 chgrp 执行类似的操作。整个事情看起来很混乱,我怀疑有一种更简单的方法来完成我需要的事情。从存储库中提取时有没有办法设置所有者和组?
I am using mercurial as part of my workflow process and it is working well. I have one niggling problem though. When I pull from my central repository down to my Linux web server in order to make an upgrade, I'm doing it with the "root" user. That appears to assign the owner and group to "root" for any files that are new or changed.
Unfortunately I run into other difficulties with that, so I'm always having to go through and reset all the files to the proper group and owner (a non-root user on the web server).
Is there some way to get mercurial to do this automatically, or does someone have a fast way of doing it? I am using the shell and having to type
chown -R username /home/username
I try to do something similar with chgrp. The whole thing seems messy, and I suspect there's a simpler way to accomplish what I need. Is there a way to set owner and group when pulling from a repository?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你应该以你而不是 root 身份进行拉动,这样你就不会遇到这个问题了。但是,如果由于某种原因这是不可行的,您始终可以使用更新挂钩来更正文件权限。在存储库的
.hg/hgrc
文件中,您可以输入:该命令将在每次
hg update
(或hg pull -u
>)。You should be pulling as you not as root and then you wouldn't have that problem. However, if that's infeasible for some reason you can always use an update hook to correct file permissions. In your repository's
.hg/hgrc
file you'd put:And that command will be automatically run after each
hg update
(orhg pull -u
).您可以通过单独定义每个钩子来添加多个钩子
You can add multiple hooks by defining each one separately