Set up Git and Mercurial
To use Bitbucket, you need to install a DVCS tool on the computer where you write your code. Typically, this computer is a machine physically close to you like your home or work computer. This is your local machine or system. You also might write or deploy code to a remote machine – for example a lab computer or a server in a data center. You may also need a DVCS tool on that machine too. This tutorial refers to the typical case, your local system, but the instructions are the same for both cases.
Bitbucket supports two DVCS tools, Git and Mercurial. These tools run on all modern operating systems. Bitbucket supports Git 1.6.6 or later and Mercurial version 1.7 or later. Mercurial also requires (depends on) the Python programming language. The installation process takes care of making sure you get the correct version of Python.
Since you can use both Git and Mercurial on the same machine, this page shows you how to install both because you need both to complete this tutorial. If you already have these tools installed, skip the instructions and go to the next step in the tutorial.
Step 1. Install Git for Windows
Here's how to install Git on your Windows machine:
- Download the Git for Windows installer package.
You can either Run the installer directly from your browser's File Download dialog or you can Save the file to a folder on your computer.
- When you've successfully started the installer, you should see the Git Setup wizard screen. Follow the Next and Finish prompts to complete the installation.
The system opens the release notes. You might want to skim them.
Open Git Bash.vbs from the Git folder of the Programs directory to open a command window.
Using the Git Bash window, you can enter the
gitcommand lines that appear in the Bitbucket documentation.
Configure your username using the following command, replacing Emma's name with your own. Copy and paste the code after the
$and press enter.
$ git config --global user.name "Emma Paris"
Configure your email address using the following command, replacing Emma's email address with your own.
$ git config --global user.email "firstname.lastname@example.org"
Step 2. (Optional) Install the Git credential helper on Windows 7 or 8
Bitbucket supports pushing and pulling over HTTP to your remote Git repositories on Bitbucket. Every time you interact with the remote repository, you must supply a username/password combination. Instead of supplying the combination with every HTTP call, you can store these credentials in your OSX keychain, provided you have the git-credential-winstore helper added to Git.
The helper asks for your username/password on the first Git operation and then stores the credential. Future operations won't require you to supply a username/password combination. To install the helper, do the following in your Windows 7 or 8 (.NET4.0 required) environment:
- Download the git-credential-winstore application.
- Make a note of where you downloaded the application.
- Start the Git Bash shell.
- In the shell, change directory to the directory with the git-credential-winstore download.
Install the credential helper by entering the following at the command line.
The command updates your global Git configuration.
Step 3. Install Mercurial
TortoiseHg 2.2.1 is the Microsoft Windows version of Mercurial.
Download the all-in-one installer (MSI version) from the Bitbucket repository (shameless promotion ) .
If you downloaded the file to a folder on your local machine, you can also click the downloaded file's icon to run the installer. When you've successfully started the installer, you should see the TortoiseHg Setup wizard screen:
The version shown on your screen may be different than the one shown here of course. That is ok as long as you are installing a TortoiseHg that supports Mercurial version 1.7 or later.
- Press Next to move to the next page of the wizard.
The setup displays the license agreement.
- Press Next to accept the license agreement and continue.
For this setup, use all the default setup values recommended by installer.
- To accept all the defaults, press Next on each page of the dialog that comes after the license agreement until the wizards prompts you to install.
- Press Install to install the software.
- Press Finish on the final page of the dialog to complete the installation.
You may need to restart your system for the installation to take effect.
Do the following to configure your global default username and email:
- Right-click in your Desktop to open the context menu.
The system displays the right hand context menu:
- Click the Hg Workbench item.
The system opens the TortoiseHg Workbench application.
- Choose File > Settings to open the TortoiseHg Settings dialog.
- Locate the Commit section on the left hand side and click it.
- Fill in the Username value using the following format:
When done the dialog looks similar to this:
- Press OK to save your changes.
Step 4. Install PuTTYgen and configure PuTTY
PuTTYgen is a free RSA and DSA key generation tool. You'll learn more about RSA, DSA, and key generation later in this tutorial. If you don't have PuTTYgen or PuTTY installed, follow the instructions below to download, install, and configure the tools:
- Download the proper version of the utilities for your system – each one is a single executable file.
- Move the
puttygen.exeexecutable to the
- Start Putty.
The PuTTy Configuration dialog displays. Use this dialog to configure your PuTTy sessions.
- Under the Session node, select Default Settings and press Load.
This allows you to edit the Default Settings session configuration.
- Under the Connection node, click SSH.
The Options controlling SSH connections display.
- Check Enable compression.
This option can improve performance of a low-band connection.
- Click the Session node, select Default Settings and press Save.
- Click the Close button (red x).
The next step is to Create an Account and a Git Repo
Was this helpful?
Thanks for your feedback!