Ownership question

Matthieu Moy Matthieu.Moy at imag.fr
Mon Feb 23 06:03:56 CST 2009


yosmc <stefan at creativitypool.com> writes:

> Anyway... I've been establishing the directory of a live website as a
> repository, by doing the following as root:

You don't want to be root here. You want to have right access on the
directory you manipulate, but this doesn't require being root. You can
create a user like www-data (or use it if it already exists), and use
the root account only to do a chown www-data on the directory.

> The problem I'm having is that all the files in the new directory are now
> owned by "root" - this creates permission problems when the developers are
> working on them,

The usual way of working is to have one repository+working tree per
developer. So each developer should "hg clone" and work in his own
copy, without any permission problem.

Having multiple developers working on the same work tree will be a
source of problems, not only permission-wise (if you don't have proper
locking of files, the risk to override other people's work is
high ...).

> but I also anticipate issues when new "root" files get pushed back
> to the original repository.

If root pushes to a repository, then the files created by the push
will be owned by root if you do a local push.

But you can "hg push ssh://other-user@localhost..." to work in a
client/server way as you would for a remote machine: the current user
will send the data to push, and an instance of mercurial running with
the right user will receive them, and write them to disk.

Think of "push" like you would for "cp": if you want to "send" a file
to an other user, you can either use scp/sftp/... or do cp followed by
chown. Same for hg push ...

-- 
Matthieu


More information about the Mercurial mailing list