Where Does Mercurial Store Config?
Mercurial reads layered config files: a per-user file in your home directory plus a per-repo .hg/hgrc that overrides it.
Last updated
Mercurial configuration is a small stack of ini-style files, and the top of the stack wins. The per-user file carries your identity and defaults across every clone on the machine. Each repository can add its own .hg/hgrc with paths, hooks, and extensions that apply only there.
The filenames differ by OS, which is the usual stumbling block. Unix-like systems use ~/.hgrc while Windows uses Mercurial.ini in the user profile. The repo-level file is .hg/hgrc everywhere, so project settings travel with the clone.
Where Mercurial stores this, by platform
~/.hgrc
Your username, default editor, extensions, and merge tool. Repo files (.hg/hgrc) override anything set here. Run hg showconfig to see the merged result with sources.
~/.hgrc
Same role and format as the Linux user file, different filename. Older installs sometimes also read ~/.hgrc on macOS through compatibility shims, but ~/.hgrc is the documented one.
%USERPROFILE%\Mercurial.ini
The Windows equivalent of ~/.hgrc. Identity and UI defaults live here. The system-wide file at C:\Program Files\Mercurial\Mercurial.ini (when present) sits below it in precedence.
Frequently asked questions
Which config file is actually active?
Run hg showconfig to print the merged result with each value's source file. It lists every file it read, so the winning entry and its origin are both visible in one place.
Can the repo config override my user config?
Yes. Anything in the repo's .hg/hgrc beats the user file, and the user file beats the system one. Keep machine quirks (editor, merge tool) in the user file and project rules (hooks, paths) in the repo file.
Notice an outdated path? Let us know.