Not trusting file .hg/hgrc from untrusted user root, group dev

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?


Solution 1:

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

[trusted]
users = root

in the /etc/mercurial/hgrc file on the server. The section.key = name syntax we use when talking about configuration settings only work on the command line.

Solution 2:

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

[trusted]
groups = yourgroup
users = youruser

Essentially, writing permissions to /repo/.hg/hgrc will not work, because the file itself is owned by an untrusted user.