Skip to content

Installing Mercurial and TortoiseHg on Ubuntu

This is a step-by-step guide on installing Mercurial and TortoiseHg on Ubuntu, and setting up a BitBucket account. This was tested on Ubuntu 12.04 LTS and Ubuntu 12.10.

Install TortoiseHg

Add TortoiseHg PPA (

sudo add-apt-repository ppa:tortoisehg-ppa/releases
sudo apt-get update
sudo apt-get install tortoisehg tortoisehg-nautilus

That installs Mercurial 2.5.1 and TortoiseHg 2.7.

Restart Nautilus

nautilus -q

Check installation

thg &

TorstoiseHg Workbench should open.

Configure user name for commits

thg &

Then select File | Settings from the top menu.

In the Commit section enter the username that will be used with commits.
The common format is: Full Name (e.g. Valentin Kantchev )

Install Mercurial keyring extension

sudo apt-get install python-setuptools
sudo easy_install keyring
sudo easy_install mercurial_keyring

Add these lines to the .hgrc (in your home directory):

mercurial_keyring =

That allows Mercurial to store and use user credentials in the Ubuntu keychain.

Setup BitBucket user (optional)

Add these lines to your global .hgrc (i.e. /home/valentin/.hgrc), change the username to your own:

[auth] =<myteamname> = <mybitbucketuser>

My final .hgrc looks like this:

# Generated by TortoiseHg settings dialog

username = Valentin Kantchev

[auth] =<myteamname> = <mybitbucketuser>

mercurial_keyring =