This topic describes how to mirror a Bitbucket repository to Cloud Source Repositories. With this configuration, commits that you push to the Bitbucket repository are copied, or mirrored, into a repository hosted in Cloud Source Repositories.
Before you begin
When you mirror a repository, you must provide Bitbucket authentication credentials. These credentials allow Cloud Source Repositories to access the contents of the Bitbucket repository.
It is recommended that you create a Bitbucket account that is specifically dedicated to automated tasks, such as mirroring a repository.
Mirroring a Bitbucket repository
The following sections describe how to mirror a Bitbucket repository to Cloud Source Repositories.
Add a new repository
Open the My Source view in the console:
Click New Repository, located in the top right corner.
The New Repository screen opens.
Select Connect external repository.
The Connect External Repository screen opens.
From the Project list, select the project for the repository.
To create a new project, click Create Project.
From the Git Provider list, select Bitbucket.
Check the box to authorize Cloud Source Repositories to store your credentials.
Connect to Bitbucket
In this step, you sign into Bitbucket and authorize Google Cloud Platform to have read access to the repository.
Click Connect to Bitbucket.
Sign in to Bitbucket using your machine user credentials.
Click Authorize GoogleCloudPlatform.
This option allows Google Cloud Platform read access to your repository.
After the authorization concludes, you are returned to the Connect External Repository screen.
A list of repositories opens.
Select the repository you want to mirror.
Click Connect Selected Repository.
The main repository screen opens. This screen contains a list of the repositories for this project, including the new repository you just created.
Identifying Bitbucket repositories
Cloud Source Repositories makes it easy to identify which of your repositories are mirrors of Bitbucket repositories:
- Each Bitbucket repository is represented with the Bitbucket logo.
- The name of the repository has
bitbucket_added to the beginning of its name.