Connect to a Bitbucket Cloud repository

This page explains how to connect to a Bitbucket Cloud repository to Cloud Build.

Before you begin

  • Enable the Cloud Build API.

    Enable the API

Connect to Bitbucket Cloud repositories


Connect Cloud Build to your Bitbucket Cloud repository by doing the following steps:

  1. Open the Repositories page in the Google Cloud console.

    Open the Repositories page

    You will see the Repositories page.

  2. In the project selector, select your Google Cloud project.

  3. Select the 2nd gen tab.

  4. Click Link repository to connect a new host to Cloud Build.

    You will see the Link repositories side panel.

  5. Connection: Select a host connection from the drop-down menu.

  6. Repository: Select a repository from the drop-down menu.

  7. Repository Resource Name: This step creates resource names for the repositories that are linked.

    • Generated: Select this option for Cloud Build to automatically generate repository resource names on your behalf for selected repositories.
    • Manual: Select this option to manually specify repository resource names.

    If you select Manual, you can modify the names for your selected repositories in the Repository names section.

  8. Click Link.


Connect to your Bitbucket Cloud repository:

gcloud builds repositories create REPO_NAME \
    --remote-uri= \
    --connection=CONNECTION_NAME --region=REGION --project=PROJECT_ID


  • REPO_NAME is the name of your repository.
  • WORKSPACE is the workspace ID for your repository.
  • REPOSITORY is the name of the repository.
  • REGION is the region for your connection.
  • CONNECTION_NAME is the name of your connection.
  • PROJECT_ID is your Google Cloud project ID.

What's next