Clone a repository

When you want to work on a project by changing its files or adding new files, you need to clone your project to your local system. 

Cloning a Mercurial repository

You can use Sourcetree, TortoiseHg, Mercurial from the terminal, or any client you like to clone your Mercurial repository. These instructions show you how to clone your repository using Mercurial from the terminal.
  1. Navigate to the repository in Bitbucket.
  2. Click the Clone button.
  3. Copy the clone command (either the SSH format or the HTTPS).
    If you are using the SSH protocol, ensure your public key is in Bitbucket and loaded on the local system to which you are cloning.
  4. Launch a terminal window.
  5. Change to the local directory where you want to clone your repository.
  6. Paste the command you copied from Bitbucket, for example:

If the clone was successful, a new sub-directory appears on your local drive. This directory has the same name as the Bitbucket repository that you cloned. The clone contains the files and metadata that Mercurial requires to maintain the changes you make to the source files.

Cloning a Git repository

You can use Sourcetree, Git from the terminal, or any client you like to clone your Git repository. These instructions show you how to clone your repository using Git from the terminal.
  1. Navigate to the repository in Bitbucket.
  2. Click the Clone button.
  3. Copy the clone command (either the SSH format or the HTTPS).
    If you are using the SSH protocol, ensure your public key is in Bitbucket and loaded on the local system to which you are cloning.
  4. Launch a terminal window.
  5. Change to the local directory where you want to clone your repository.
  6. Paste the command you copied from Bitbucket, for example:

    $ git clone ssh://git@bitbucket.example.com:7999/PROJ/repo.git

     

If the clone was successful, a new sub-directory appears on your local drive. This directory has the same name as the Bitbucket repository that you cloned. The clone contains the files and metadata that Git requires to maintain the changes you make to the source files.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport