Mirroring a Bitbucket repository

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.

Note: Make sure you are signed out of Bitbucket before you mirror a repository. This helps ensure you can select the right account when you connect the repository to Cloud Source Repositories.

Add a new repository

  1. Open Cloud Source Repositories in the console:

    Open Cloud Source Repositories

  2. Click Add Repository, located in the top right corner.

    The New Repository screen opens.

  3. Select Connect external repository.

  4. Click Continue.

    The Connect External Repository screen opens.

  5. From the Project list, select the project for the repository.

    To create a new project, click Create Project.

  6. From the Git Provider list, select Bitbucket.

  7. 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.

  1. Click Connect to Bitbucket.

  2. Sign in to Bitbucket using your machine user credentials.

  3. 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.

  4. Select the repository you want to mirror.

  5. 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.

Upgrading a Bitbucket connection

If you set up Bitbucket mirroring in the earlier Google Cloud Platform Console interface, Cloud Source Repositories prompts you to upgrade when you access your mirrored repository in the current source console. You will be prompted again each time you access the repository until you complete the upgrade. You must have the Source Repository Administrator role to upgrade the connection.

Upgrading the connection does not change the mirroring behavior with the Bitbucket repository.

Note: Make sure you are signed out of Bitbucket before you upgrade the connection. This helps ensure you can select the right account when you connect the repository to Cloud Source Repositories.

  1. Open Cloud Source Repositories in the console:

    Open Cloud Source Repositories

  2. Navigate to the mirrored Bitbucket repository.

  3. When prompted, click Upgrade Credentials to upgrade your connection.

Forcing repository sync

Once you have set up mirroring, Cloud Source Repositories automatically syncs your repository with the mirrored repository when a user commits a change. Cloud Source Repositories allows you to view the last time your mirrored repository was synced and manually force a sync if necessary.

  1. Browse to the repository in the source console.

  2. Click the Settings icon in the upper right-hand corner of the display.

  3. The sync status is displayed on the page.

    Mirrored repository sync status

  4. Click Sync from Bitbucket to manually force a sync of the repositories.

Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
Cloud Source Repositories