scythargon
scythargon

Reputation: 3491

Mercurial: no ~/.hgrc file

I am trying to go though this tutorial that says:


Enable SSH compression for Mercurial

Edit the Mercurial global configuration file (~/.hgrc). Add the following line to the UI section:

ssh = ssh -C


But there is no that file in my system. HG of course is installed.

Upvotes: 25

Views: 33334

Answers (3)

Patrick
Patrick

Reputation: 13974

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

Upvotes: 26

Anthon
Anthon

Reputation: 76882

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

Upvotes: 1

Josh Sutterfield
Josh Sutterfield

Reputation: 1997

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)

Upvotes: 10

Related Questions