不信任来自不受信任的用户 root、dev 组的文件 .hg/hgrc
该存储库由用户 root 和组 dev 所有。
另一个用户正在存储库上运行 hg update
并收到以下消息:
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file .hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
abort: Permission denied: /dev/src/backend/java/com/tt/afr/schedule/service/ScheduleComparator.java
在 /etc/mercurial/hgrc
中,我们有:
trusted.users=root
在运行hg update
的用户的主目录中,我们有这个hgrc文件:
[trusted]
users = root
groups = dev
用户正在使用ssh
连接到服务器并运行命令。
我们可以做什么来解决这个问题?
The repository is owned by user root, and group dev
Another user is running hg update
on the repository and getting the following messages:
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file .hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
abort: Permission denied: /dev/src/backend/java/com/tt/afr/schedule/service/ScheduleComparator.java
In /etc/mercurial/hgrc
, we have:
trusted.users=root
In the home directory of user running hg update
, we have this hgrc file:
[trusted]
users = root
groups = dev
User is connecting to server using ssh
and running the commands.
What can we do to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
请阅读有关 Mercurial 信任的帮助,并确保您已添加信任设置在服务器上。当您通过 SSH 连接时,您在本地信任或不信任谁并不重要 - 您在服务器上运行的
hg
二进制文件(通过 SSH 隧道)需要信任配置文件。另请注意,您需要将
/etc/mercurial/hgrc
文件放入服务器上。我们在讨论配置设置时使用的section.key = name
语法仅适用于命令行。Please read the help on trust in Mercurial and make sure that you've added the trust settings on the server. When you connect over SSH, it does not matter who you trust or don't trust locally — it's the
hg
binary that you run on the server (via the SSH tunnel) that needs to trust the config file.Also note that you need to put
in the
/etc/mercurial/hgrc
file on the server. Thesection.key = name
syntax we use when talking about configuration settings only work on the command line.对于已将此解决方案添加到其 /repo/.hg/hgrc 但没有发生任何事情的其他人,此解决方案对我有用:
https://j.ee.washington.edu/trac/gmtk/ticket/33
添加在
/etc/mercurial/hgrc.d/trust.rc
中,本质上,对 /repo/.hg/hgrc 的写入权限将不起作用,因为该文件本身由不受信任的用户拥有。
For everybody else who has added this solution to their /repo/.hg/hgrc and nothing happened, this solution worked for me:
https://j.ee.washington.edu/trac/gmtk/ticket/33
Add in
/etc/mercurial/hgrc.d/trust.rc
Essentially, writing permissions to /repo/.hg/hgrc will not work, because the file itself is owned by an untrusted user.
根据DustWolf的回答,这可以在WSL(Linux的Windows子系统)下的Ubuntu上使用使用Microsoft的WSL
drvfs
文件系统驱动程序(即hg 在共享驱动器上本地运行。
在 WSL 计算机上创建
trust.rc
:添加:
保存
trust.rc
和hg
现在应该信任存储库hgrc
因为 WSL 的drvfs
驱动程序将共享挂载为 root:root。wsl wsl-drvfs
Based on the answer by DustWolf, this works on Ubuntu under WSL (Windows Subsystem for Linux) using a Windows drive letter share mounted using Microsoft's WSL
drvfs
file system driver, i.e.,hg
running locally on a shared drive.Create
trust.rc
on the WSL machine:Add:
Save
trust.rc
andhg
should now trust the repohgrc
as WSL'sdrvfs
driver mounts the share as root:root.wsl wsl-drvfs
不是你的情况,但可能值得提示:
我在设置为将存储库从 hg 迁移到 GitLab 的本地容器中遇到此错误。只需将下载的 hg 存储库文件夹中的
.hg
目录的所有权更改为 root 用户/组即可解决此问题:并且消息
not trusting file /data/hg-repo/.hg来自不受信任的用户 1000、组 1000 的 /hgrc 消失了。
Not your case, but might be worth a hint:
I had this error in a local container that was setup to migrate repos from hg to GitLab. Solved it by just by changing the ownership of the
.hg
directory in the downloaded hg's repository folder to root user/group:And the message
not trusting file /data/hg-repo/.hg/hgrc from untrusted user 1000, group 1000
was gone.