Clone a repository

Cloning a repository syncs it to your local machine. After you clone, you can add and edit files and then push and pull updates.

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. From the repository, click + in the global sidebar and select Clone this repository under Get to work.
  2. 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.
  3. From a terminal window, change to the local directory where you want to clone your repository.
  4. Paste the command you copied from Bitbucket, for example:

    Clone over HTTPS:
     $ git clone https://username@bitbucket.org/teamsinspace/documentation-tests.git
    Clone over SSH:
    $ git clone git@bitbucket.org:teamsinspace/documentation-tests.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.

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. From the repository, click + in the global sidebar and select Clone this repository under Get to work.
  2. 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.
  3. From a terminal window, change to the local directory where you want to clone your repository.
  4. Paste the command you copied from Bitbucket, for example:

    Clone over HTTPS:
     $ hg clone https://username@bitbucket.org/teamsinspace/hg-documentation-tests
    Clone over SSH:
    $ hg clone ssh://hg@bitbucket.org/teamsinspace/hg-documentation-tests

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 repository with Sourcetree

Whether you are using Git or Mercurial, you can use Sourcetree to clone your repository. If you aren't familiar with Sourcetree, it's our client that provides an alternative to the command line. Follow these instructions to clone your repository.

  1. From the repository, click the Clone in Sourcetree icon then button.
    Sourcetree launches with the Clone New dialog.
  2. Click the Clone button.
  3. If necessary, update the Destination Path or Bookmark Name.
    The Destination Path is the folder where your clone saves to your local system. The Bookmark Name is the name of that folder.
    At this point, the dialog should look similar to the following:
  4. Press Clone
    Sourcetree creates the folder on your local system. You can use the Sourcetree to interact with the repository.
    1. Branches list: Lists your Mercurial and Git branches.
    2. Files list: Includes all the files in your repository.
    3. Action buttons: Allows you to interact with the repository.
    4. Commits list: Includes a list of commits to the repository and details of each commit.
    5. Selected file: Shows a diff of the selected file.
最終更新日 2017 年 9 月 13 日

この翻訳に満足しましたか?

はい
いいえ
この記事についてのフィードバックを送信する

Not finding the help you need?

コミュニティへの質問

Powered by Confluence and Scroll Viewport.