Mercurial: no ~/.hgrc file

It is not there by default. You don't need it to exist — it just can exist to customize how you use Mercurial. You just need to create a .hgrc file in your home directory and it should work.

Heres a great intro post: http://hgtip.com/tips/beginner/2009-09-30-configuring-mercurial


For up-to-date versions of mercurial, you should use the XDG compatible location. Unless you explicitly set XDG_CONFIG_HOME the settings should go into the file:

~/.config/hg/hgrc

Less clutter in your home directory and ~/.config/hg/ can also be used for files like a common hgignore


Snagged from the manpages at https://www.selenic.com/mercurial/hgrc.5.html.

Files

Mercurial reads configuration data from several files, if they exist. These files do not exist by default and you will have to create the appropriate configuration files yourself:

Local configuration is put into the per-repository /.hg/hgrc file.

Global configuration like the username setting is typically put into:

%USERPROFILE%\mercurial.ini
$HOME/.hgrc

The names of these files depend on the system on which Mercurial is installed. *.rc files from a single directory are read in alphabetical order, later ones overriding earlier ones. Where multiple paths are given below, settings from earlier paths override later ones.

On Unix, the following files are consulted:

  • /.hg/hgrc (per-repository)
  • $HOME/.hgrc (per-user)
  • /etc/mercurial/hgrc (per-installation)
  • /etc/mercurial/hgrc.d/*.rc (per-installation)
  • /etc/mercurial/hgrc (per-system)
  • /etc/mercurial/hgrc.d/*.rc (per-system)
  • /default.d/*.rc (defaults)

On Windows, the following files are consulted:

  • /.hg/hgrc (per-repository)
  • %USERPROFILE%.hgrc (per-user)
  • %USERPROFILE%\Mercurial.ini (per-user)
  • %HOME%.hgrc (per-user)
  • %HOME%\Mercurial.ini (per-user)
  • HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial (per-installation)
  • \hgrc.d*.rc (per-installation)
  • \Mercurial.ini (per-installation)
  • /default.d/*.rc (defaults)

Tags:

Mercurial