Mercurial: no ~/.hgrc file
Asked Answered
M

3

25

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.

Metallist answered 7/10, 2012 at 19:18 Comment(1)
D
26

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

Drowsy answered 7/10, 2012 at 19:27 Comment(0)
G
10

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)
Genevagenevan answered 20/1, 2016 at 21:42 Comment(0)
Z
1

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

Zachariahzacharias answered 29/1, 2022 at 8:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.