Mercurial is a DVCS that transfers code between your local system and Bitbucket Cloud. Follow the instructions on this page to install and set up Mercurial. If you write or deploy code to a remote machine, you may also need Mercurial on that machine as well.

Step 1. Install Mercurial

If you already have Mercurial installed, make sure you have version 1.7 or later. To check, enter  hg --version  at the command line.

Depending on your operating system:

  • For WindowsDownload the Mercurial installerTo open a command window, search for the Command Prompt.
  • For MacDownload the Mercurial installer. To open a command window, search for the Terminal.
  • For Linux:

    1. Enter cat /etc/apt/sources.list at the command line to see the contents of the file.

    2. If any of the lines are commented (have a # prefix), then edit the file and remove all # from the comments.

    3. Make sure you have an updated package list by entering sudo apt-get update at the command line.

    4. To install Mercurial, enter sudo apt-get install mercurial. Verify the installation was successful by typing  which hg at the command line.

Step 2: Update your configuration file

When you install Mercurial, it comes with a configuration file that you update with your personal settings from a command window.

  1. Determine if you already have a  .hgrc  file in your user directory with following command:
    • For Windows:  ls .hgrc
    • For Mac and Linux:  ls ~/.hgrc
  2. If you don't have the  .hgrc  file, create one using the touch command:

    $ touch ~/.hgrc

  3. Open the .hgrc  file, and add a username value to the configuration, making it look similar to the following:

    # Name data to appear in commits
    username = Emma Paris <>
tip/resting Created with Sketch.

Files that start with a . (period) are hidden files in Mac OSX. By default, the Finder does not show these files. To reveal hidden files, enter the following command into the terminal:

$ defaults write AppleShowAllFiles YES

To hide the files once again, enter the following command:

$ defaults write AppleShowAllFiles NO