Setting up your account & first Mercurial repository

Table of Contents

This commit

commit 059634c712b8ed35a8456044c19b5418ecbf21c1
Author: Drew DeVault <>
Date:   2019-08-15T00:58:15+00:00

Improve OpenBSD compatibility list
Clone this wiki (read-only) (read/write)

If this is your first time using Mercurial, we recommend starting with the official Mercurial Guide.

Prefer git? Check out the corresponding git tutorial.

Thanks for signing up for! Let's start by setting up your profile details. Your profile page is on, the account management service. You can fill in some basic (and optional) details like your bio on your profile page. Before we can get any work done, however, we need to set up your SSH key and add it on the keys page.

Generating an SSH key does not support pushing to Mercurial repositories over HTTPS with a username+password - SSH keys are mandatory. If you already have an SSH key, you can skip this step. If not, run the following command to generate one:


If you accept the defaults, the public key will be written to ~/.ssh/ and the private key to ~/.ssh/id_rsa.

Uploading your key to

The keys page has a form for adding your SSH key. If you followed the earlier instructions to generate an SSH key, your public key is stored at ~/.ssh/ Copy the contents of this file to your clipboard and paste it into the text field. Click Add key and your key will now be valid for pushing to Mercurial repositories.

Specifying a Key

If you already use multiple SSH keys, remember to specify which key to use with services. Edit ~/.ssh/config and add an appropriate Host entry that gives the path to the private key you wish to use:

Host *
  IdentityFile ~/.ssh/srht.id_rsa
  PreferredAuthentications publickey

Creating a Mercurial repository

If you already have a Mercurial repository you want to push to, you can skip this step. If not, open up a shell and run the following commands to create a test repository for experimenting with:

mkdir example
cd example
hg init
echo "Hello world!" >
hg add
hg commit -m "Initial commit"

This created a new Mercurial repository and added a file to it, then created the initial commit.

Pushing your repository to

Run the following command to push your changes to

hg push ssh://

Since this repository didn't previously exist, you'll be prompted with a link to create the repository on - click that link and fill out the form on that page. You'll be redirected to your repository on you're done!

You can save yourself some typing and just run hg push next time by adding this to .hg/hgrc:

default = ssh://
Tip: You can create repositories on the web on the new repository page.

Next: Getting started with

Other resources: