Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way for me to refer to an external configuration in Mercurial? Our repository is on a shared drive so at the moment the last user to use it is the username it keeps since by default hgrc is under the .hg folder local to the repository.

share|improve this question
up vote 2 down vote accepted

You could place one in the root of your home directory.

According to the man page, the following locations are checked for per-user configuration files.

   (Unix) $HOME/.hgrc
   (Windows) %USERPROFILE%\.hgrc
   (Windows) %USERPROFILE%\Mercurial.ini
   (Windows) %HOME%\.hgrc
   (Windows) %HOME%\Mercurial.ini

In your per user .hgrc you can have a section like this:

username =Your Name<>

When you commit and push, the push destinations in .hg/hgrc will be used and your username from the per user file will be used for the commit.

Also, you should consider sharing your repository in a way other then a shared drive. hg lets you pull and push from each computer with a repository and if you need the notion of a 'central repo' you could put it behind hgweb.cgi and push via https or ssh

share|improve this answer

I agree completely with Daniel — each user should configure the username in his personal config file. The .hg/hgrc file should not contain a username.

However, let me answer your question about include files: you can include one configuration file in another with:

%include some/file

See the hgrc(5) man page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.