Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
Cloning a repository syncs it to your local machine. After you clone, you can add and edit files and then push and pull updates.
This article refers to the command line. If you aren't familiar with the command line, check out our videos tutorials for your operating system:
(Windows) Setting up Git on Windows
Prior to cloning or interacting with a Bitbucket Cloud repository using git, you'll need to either:
install the Git Credential Manager (included with Git for Windows for Windows users)
You can use Sourcetree, Git from the command line, or any client you like to clone your Git repository. These instructions show you how to clone your repository using Git from the terminal.
From the repository, select the Clone button.
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.
From a terminal window, change to the local directory where you want to clone your repository.
Paste the command you copied from Bitbucket, for example:
Clone over HTTPS
1
$ git clone https://username@bitbucket.org/teamsinspace/documentation-tests.git
Git Credential Manager users — A new window will open and ask you to log into bitbucket.org and authorize the connection.
Clone over SSH
1
$ git clone git@bitbucket.org:teamsinspace/documentation-tests.git
If the clone was successful, a new sub-directory appears on your local drive in the directory where you cloned your repository. 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.
You can also 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. If you don't have SourceTree, download the application first.
From the repository, select the Clone button.
In the Clone this repository dialog, select the Clone in Sourcetree button.
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.
Select the Clone button.
Sourcetree creates the folder on your local system. You can use the Sourcetree to interact with the repository.
A. Branches list: Lists your Git branches.
B. Files list: Includes all the files in your repository.
C. Action buttons: Allows you to interact with the repository.
D. Commits list: Includes a list of commits to the repository and details of each commit.
E. Selected file: Shows a diff of the selected file.
You can also use Visual Studio (VS) Code to clone your repository. If you aren't familiar with VS Code, it's a source code editor developed by Microsoft that provides an alternative to the command line. Follow these instructions to clone your repository. If you don't have Visual Studio Code, download the application first.
From the repository, select the Clone button.
In the Clone this repository dialog, select the Clone in VS Code button.
If you have not already installed the Atlassian for VS Code extension, you will be prompted to install it. Select Install > select the Reload Window and Open button in the info dialog.
In VS Code, select Clone a new copy from the dropdown menu.
When prompted, select the local storage location where you want to keep the cloned repository.
Select the Select repository location button.
Your repository will be cloned and stored in the location you chose. You can then open the repository and begin working on it in VS Code.
You may be prompted to log in to your Bitbucket Cloud account so VS Code can access the necessary data to clone your repository.
Was this helpful?