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, or any client you like to clone your Mercurial repository.  These instructions show you how to clone your repository with Sourcetree.

  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,  you must make sure your public key is in Bitbucket and loaded on the local system you are cloning to.
  4. Launch Sourcetree.
  5. Click the Add Repository button.
  6. Enter a Destination Path.
     This is the folder where your clone is added to your local system.
  7. Paste the clone command you copied from Bitbucket. 
    At this point the dialog should look similar to the following:
     
  8. Press Clone
    Sourcetree creates the folder on your local system.  You can use the Sourcetree to interact with the repository. 

     

Cloning a Git repository

You can use Sourcetree, GitBash, or any client you like to clone your Git repository.  These instructions show you how to clone your repository with GitBash.

  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,  you must make sure your public key is in Bitbucket and loaded on the local system you are cloning to.
  4. Launch  a GitBash terminal.
  5. Change to the local directory  where you want to clone your Bitbucket repository.
  6. Paste the command you copied from Bitbucket, for example:

    git clone git@bitbucket.org:tutorials/mydvcsproject.git

    If you were 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!

4 Archived comments

  1. User avatar

    Anonymous

    How do I fix this error if it persists after loading an SSH key in Pageant?

    Authentication via SSH keys failed, do you want to launch the SSH key agent (Pageant) and retry?

    (If you don't have an SSH key yet, you can create or import it using the menu option Tools > Create or Inport SSH Keys)

    25 Jun 2013
    1. User avatar

      Anonymous

      Never mind, used Mercurial instead.

      25 Jun 2013
    1. User avatar

      manthony

      It sounds like Pageant isn't running.  It is your key agent so Pageant needs to run all the time on your Windows system when you are using SSH to authentication. Here is an article about how to start Pageant and load your keys automatically:

      http://blog.shvetsov.com/2010/03/making-pageant-automatically-load-keys.html

       

      25 Jun 2013
  2. User avatar

    Anonymous

    I followed all the steps but I got "Fatal: could not read password for..." Somebody knows how i can solve this?

    06 Feb 2014
Powered by Confluence and Scroll Viewport