En el selector de proyectos, selecciona tu proyecto de Google Cloud .
Selecciona la pestaña 2ª gen.
Haz clic en Vincular repositorio para conectar un host nuevo a Cloud Build.
Verás el panel lateral Vincular repositorios.
Connection: Selecciona una conexión de host en el menú desplegable.
Repositorio: Selecciona un repositorio en el menú desplegable.
Nombre del recurso del repositorio: En este paso, se crean nombres de recursos para los repositorios vinculados.
Generado: Selecciona esta opción para que Cloud Build genere automáticamente nombres de recursos del repositorio en tu nombre para los repositorios seleccionados.
Manual: Selecciona esta opción para especificar manualmente los nombres de recursos del repositorio.
Si seleccionas Manual, puedes modificar los nombres de los repositorios seleccionados en la sección Nombres de los repositorios.
Haz clic en Vincular.
gcloud
Sigue estos pasos para conectarte a tu repositorio de Bitbucket Cloud:
CONNECTION_NAME es el nombre que se le asignó a la conexión de host de Bitbucket Cloud creada en Cloud Build desde Conéctate a un host de Bitbucket Cloud.
RESOURCE_NAME es el nombre del recurso google_cloudbuildv2_connection. Por ejemplo, my-connection del ejemplo de Terraform en Conéctate a un host de Bitbucket Cloud.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eThis guide outlines the process of connecting a Bitbucket Cloud repository to Cloud Build.\u003c/p\u003e\n"],["\u003cp\u003eBefore initiating the connection, it is necessary to enable the Cloud Build API and set up a connection to a Bitbucket Cloud host.\u003c/p\u003e\n"],["\u003cp\u003eConnections can be established through the Google Cloud console, which offers options for automatically generating repository resource names or specifying them manually.\u003c/p\u003e\n"],["\u003cp\u003eThe gcloud CLI provides an alternative method for connecting to a Bitbucket Cloud repository, requiring specification of repository, workspace, connection, region, and project details.\u003c/p\u003e\n"],["\u003cp\u003eTerraform configuration can also be employed to link a Bitbucket Cloud repository, which mandates detailing the project ID, workspace ID, repository name, region, and resource name.\u003c/p\u003e\n"]]],[],null,["# Connect to a Bitbucket Cloud repository\n\nThis page explains how to connect a [Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/get-started-with-bitbucket-cloud/) repository\nto Cloud Build.\n\nBefore you begin\n----------------\n\n-\n\n\n Enable the Cloud Build API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com&redirect=https://cloud.google.com/build/docs/automating-builds/bitbucket/connect-repo-from-bitbucket-cloud)\n\n\u003c!-- --\u003e\n\n- Follow instructions in [Connect to a Bitbucket Cloud host](/build/docs/automating-builds/bitbucket/connect-host-bitbucket-cloud).\n\nConnect to Bitbucket Cloud repositories\n---------------------------------------\n\n### Console\n\nConnect Cloud Build to your Bitbucket Cloud repository by\ndoing the following steps:\n\n1. Open the **Repositories** page in the Google Cloud console.\n\n [Open the Repositories page](https://console.cloud.google.com/cloud-build/repositories)\n\n You will see the **Repositories** page.\n2. In the project selector, select your Google Cloud project.\n\n3. Select the **2nd gen** tab.\n\n4. Click **Link repository** to connect a new host to Cloud Build.\n\n You will see the **Link repositories** side panel.\n5. **Connection**: Select a host connection from the drop-down menu.\n\n6. **Repository**: Select a repository from the drop-down menu.\n\n7. **Repository Resource Name**: This step creates resource names for the\n linked repositories.\n\n - **Generated**: Select this option for Cloud Build to automatically generate repository resource names on your behalf for selected repositories.\n - **Manual**: Select this option to manually specify repository resource names.\n\n If you select **Manual** , then you can modify the names for your\n selected repositories in the **Repository names** section.\n8. Click **Link**.\n\n### gcloud\n\nConnect to your Bitbucket Cloud repository: \n\n gcloud builds repositories create \u003cvar translate=\"no\"\u003eREPO_NAME\u003c/var\u003e \\\n --remote-uri=https://bitbucket.org/\u003cvar translate=\"no\"\u003eWORKSPACE\u003c/var\u003e/\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e.git \\\n --connection=\u003cvar translate=\"no\"\u003eCONNECTION_NAME\u003c/var\u003e --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eREPO_NAME\u003c/var\u003e is the name of your repository.\n- \u003cvar translate=\"no\"\u003eWORKSPACE\u003c/var\u003e is the workspace ID for your repository.\n- \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e is the name of the repository.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the [region](/build/docs/locations) for your connection.\n- \u003cvar translate=\"no\"\u003eCONNECTION_NAME\u003c/var\u003e is the name given to the Bitbucket Cloud host connection created in Cloud Build from [Connect to a Bitbucket Cloud host](/build/docs/automating-builds/bitbucket/connect-host-bitbucket-cloud#connect-host).\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#get_an_existing_project).\n\n### Terraform\n\nTo add a Bitbucket Cloud repository to your connection, add the following\ncode snippet to your Terraform configuration: \n\n resource \"google_cloudbuildv2_repository\" \"my-repository\" {\n project = \"\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\"\n name = \"\u003cvar translate=\"no\"\u003eREPO_NAME\u003c/var\u003e\"\n location = \"\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\"\n parent_connection = google_cloudbuildv2_connection.\u003cvar translate=\"no\"\u003eRESOURCE_NAME\u003c/var\u003e.name\n remote_uri = \"https://bitbucket.org/\u003cvar translate=\"no\"\u003eWORKSPACE_ID\u003c/var\u003e/\u003cvar translate=\"no\"\u003eREPO_NAME\u003c/var\u003e.git\"\n }\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#get_an_existing_project).\n- \u003cvar translate=\"no\"\u003eWORKSPACE_ID\u003c/var\u003e is the workspace ID for your repository.\n- \u003cvar translate=\"no\"\u003eREPO_NAME\u003c/var\u003e is the name of your repository.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the [region](/build/docs/locations) for your connection.\n- \u003cvar translate=\"no\"\u003eRESOURCE_NAME\u003c/var\u003e is the name of the `google_cloudbuildv2_connection` resource. For example, `my-connection` from the Terraform example in [Connect to a Bitbucket Cloud host](/build/docs/automating-builds/bitbucket/connect-host-bitbucket-cloud#terraform).\n\nWhat's next\n-----------\n\n- Learn how to [build repositories from a Bitbucket Cloud](/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-cloud).\n- Learn how to [view build results](/build/docs/view-build-results).\n- Learn how to [perform blue/green deployments on Compute Engine](/build/docs/deploying-builds/deploy-compute-engine)."]]