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 (https://launchpad.net/~tortoisehg-ppa/+archive/releases)

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):

[extensions]
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]
bitbucket.org.prefix = bitbucket.org/<myteamname>
bitbucket.org.username = <mybitbucketuser>

My final .hgrc looks like this:

# Generated by TortoiseHg settings dialog

[ui]
username = Valentin Kantchev

[auth]
bitbucket.org.prefix = bitbucket.org/<myteamname>
bitbucket.org.username = <mybitbucketuser>

[extensions]
mercurial_keyring =