Mercurial permission management decides who can push, pull, clone, or commit. Get it wrong, and your repository becomes either too open or too locked down. In teams that rely on Mercurial for version control, precise permission control prevents code leaks, accidental overwrites, and wasted hours on conflicts.
Mercurial supports multiple layers of permission control. At the file system level, you can restrict read and write access to the repository directory. At the server level, configuration in hgweb.config or hgrc files defines who can access what. This includes both HTTP authentication and SSH-based rules. For granular control, the hg-serve and hgweb setups allow path-based permissions, limiting write access to specific branches or paths inside the repo.
The most common way to enforce detailed rules is through the acl extension. With it, you can declare who can push to a branch, who can commit changes, and who is entirely blocked. ACL rules live in the repository’s .hgrc, with sections like [acl.allow] and [acl.deny] for fine-grained control. For example: