Bitbucket setup on OSX Lion using Mercurial

by ingvar 12. February 2012 08:05

Here is a fast guide to getting Mercurial and bitbucket working from the terminal in OSX Lion, enjoy :)

1. Download and install Mercurial

Download binaries from and install.

2. Creating Mercurial configuration

Create a .hgrc filer in your home folder: ~/.hcrg and add the following lines. Change the name and email to your name and email used ont butbucket.

username = Jon Doe <>
ssh = ssh -C

3. Configure SSH 

3.1: Set up your default identity by issuing the following command and entering a proper password


3.2: Copy the public key to your clipboard using the following command

cat ~/.ssh/ | pbcopy

3.3 Add public key to bitbucket by browsing to Account -> SSH Keys and past the public key in the textbox left to the 'Add key' button. Then click the 'Add key' button.

4. All done!

Rember to use the SSH URL when cloning the repository and not the HTTPS url.


About the author

Martin Ingvar Kofoed Jensen

Architect and Senior Developer at Composite on the open source project Composite C1 - C#/4.0, LINQ, Azure, Parallel and much more!

Follow me on Twitter

Read more about me here.

Read press and buzz about my work and me here.

Stack Overflow

Month List