Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta página, explicamos como conectar um repositório do GitLab ao Cloud Build. Para saber mais sobre os repositórios do Cloud Build, consulte Repositórios do Cloud Build.
Saiba como criar e implantar suas cargas de trabalho no Google Cloud usando componentes de CI/CD gerenciados pelo Google no seu pipeline do GitLab. Consulte GitLab no Google Cloud.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[[["\u003cp\u003eThis guide explains how to connect a GitLab repository to Cloud Build for automated builds.\u003c/p\u003e\n"],["\u003cp\u003eBefore connecting a repository, you must enable the Cloud Build and Secret Manager APIs.\u003c/p\u003e\n"],["\u003cp\u003eYou must connect a GitLab host before connecting repositories.\u003c/p\u003e\n"],["\u003cp\u003eYou can link a repository using the Google Cloud console by selecting a connection and the repository you want to link.\u003c/p\u003e\n"],["\u003cp\u003eThe gcloud command can also be used to link a GitLab repository to Cloud Build, requiring the repository name, URI, connection name, and region.\u003c/p\u003e\n"]]],[],null,["# Connect to a GitLab repository\n\nThis page explains how to connect a [GitLab](https://about.gitlab.com/) repository to Cloud Build. To learn more about Cloud Build repositories, see [Cloud Build repositories](/build/docs/repositories).\n\nBefore you begin\n----------------\n\n-\n\n\n Enable the Cloud Build and Secret Manager APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com,secretmanager.googleapis.com&redirect=https://cloud.google.com/build/docs/automating-builds/gitlab/connect-repo-gitlab)\n\n\u003c!-- --\u003e\n\n- Follow the instructions to [connect a GitLab host](/build/docs/automating-builds/gitlab/connect-host-gitlab) before connecting repositories.\n\nConnect to a GitLab repository\n------------------------------\n\n### Console\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 see the **Repositories** page.\n2. At the top of the page, select the **2nd gen** tab.\n\n3. In the project selector in the top bar, select your Google Cloud project.\n\n4. Click **Link repository** to link repositories from your connection.\n\n You see the **Link repository** panel.\n5. In the **Link repository** panel, enter the following information:\n\n 1. **Connection**: Select a connection from the drop-down menu.\n 2. **Repository**: Select a repository to link to your connection.\n\n 3. **Repository Name**: Enter a name for your repository.\n\n 1. **Generated**: Select this option for Cloud Build to automatically generated repository names on your behalf for selected repositories.\n 2. **Manual**: Select this option to manually specify names for your\n selected repositories.\n\n If you select **Manual** , you can modify the names for your\n selected repositories in the **Repository names** section.\n6. Click **Link** to link your repository to your connection.\n\n### gcloud\n\nTo add a GitLab repository to your connection, enter the following\ncommand: \n\n gcloud builds repositories create \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREPO_NAME\u003c/span\u003e\u003c/var\u003e \\\n --remote-uri=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREPO_URI\u003c/span\u003e\u003c/var\u003e \\\n --connection=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCONNECTION_NAME\u003c/span\u003e\u003c/var\u003e --region=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION\u003c/span\u003e\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\"\u003eREPO_URI\u003c/var\u003e is the link to your GitLab repository.\n- \u003cvar translate=\"no\"\u003eCONNECTION_NAME\u003c/var\u003e is the name given to the GitLab connection created in Cloud Build from [Connect to a GitLab host](/build/docs/automating-builds/gitlab/connect-host-gitlab#connecting_to_a_gitlab_host).\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the [region](/build/docs/locations) for your connection.\n\nYou have now linked a repository to your GitLab connection.\n\nWhat's next\n-----------\n\n- Learn how to [build repositories from GitLab](/build/docs/automating-builds/gitlab/build-repos-from-gitlab).\n- Learn how to build and deploy your workloads to Google Cloud using Google-managed CI/CD components in your GitLab pipeline. See [GitLab on Google Cloud](/docs/gitlab)."]]