[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[[["\u003cp\u003eThis guide outlines the process of connecting a GitHub Enterprise repository to Cloud Build, focusing on 2nd gen repositories.\u003c/p\u003e\n"],["\u003cp\u003eBefore linking, users must enable the Cloud Build and Secret Manager APIs and have admin access on the GitHub Enterprise repositories they intend to connect.\u003c/p\u003e\n"],["\u003cp\u003eThe process of connecting a repository can be accomplished through the Google Cloud console, the gcloud command-line tool, or via Terraform configuration.\u003c/p\u003e\n"],["\u003cp\u003eWhen linking via the console, users can opt to have Cloud Build automatically generate repository names or manually specify them.\u003c/p\u003e\n"],["\u003cp\u003eRegardless of the connection method used, collaborators will need administrator permissions in GitHub to connect the repository to Cloud Build.\u003c/p\u003e\n"]]],[],null,["# Connect to a GitHub Enterprise repository\n\n1st gen 2nd gen\n\nThis page explains how to connect a [GitHub Enterprise](https://docs.github.com/en/enterprise-server) 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/github/connect-repo-github-enterprise)\n\n\u003c!-- --\u003e\n\n- Follow the instructions to [connect a GitHub Enterprise host](/build/docs/automating-builds/github/connect-host-github-enterprise).\n- Ensure you have administrator access on repositories where you want to enable GitHub Enterprise triggers.\n\nConnect to a GitHub Enterprise repository\n-----------------------------------------\n\n### Console\n\nTo connect a GitHub Enterprise repository to a host connection, complete 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 see the **Repositories** page.\n2. At the top of the page, select the **2nd gen** tab.\n\n3. Click **Link Repository** to link repositories from your connection.\n\n You see the **Link repositories** panel.\n4. In the **Link Repositories** 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.\n\n | **Note:** If you're a collaborator, you need administrator permissions in GitHub to see the repository.\n5. Click **Link** to link your repository to your connection.\n\nYou have now successfully linked your GitHub Enterprise repository to your connection.\n\n### gcloud\n\nTo add a GitHub Enterprise 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 GitHub repository.\n- \u003cvar translate=\"no\"\u003eCONNECTION_NAME\u003c/var\u003e is the name given to the GitHub Enterprise host connection created in Cloud Build from [Connect to a GitHub Enterprise host](/build/docs/automating-builds/github/connect-host-github-enterprise#connecting_to_a_github_enterprise_host).\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the [region](/build/docs/locations) for your connection.\n\n| **Note:** If you're a collaborator, you need administrator permissions in GitHub to connect to the repository.\n\n### Terraform\n\nTo add a GitHub Enterprise 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\"\u003e\u003cspan class=\"devsite-syntax-err\"\u003eREGION\u003c/span\u003e\u003c/var\u003e\"\n parent_connection = google_cloudbuildv2_connection.my-connection.name\n remote_uri = \"\u003cvar translate=\"no\"\u003eREMOTE_URI\u003c/var\u003e'\n }\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is your Google Cloud project ID.\n- \u003cvar translate=\"no\"\u003eREPO_NAME\u003c/var\u003e is the name of your GitHub repository.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the [region](/build/docs/locations) for your connection.\n- \u003cvar translate=\"no\"\u003eURI\u003c/var\u003e is the remote URI of your repository. For example, `https://github.com/myuser/myrepo.git`.\n\n| **Note:** If you're a collaborator, you need administrator permissions in GitHub to connect to the repository.\n\nNext steps\n----------\n\n- Learn how to [build repositories from GitHub Enterprise](/build/docs/automating-builds/github/build-repos-from-github-enterprise).\n- Learn how to [build repositories from GitHub Enterprise in a private network](/build/docs/automating-builds/github/build-repos-from-github-enterprise-private-network).\n- Learn how to [perform blue-green deployments on Compute Engine](/build/docs/deploying-builds/deploy-compute-engine).\n- Learn how to [specify additional repositories](/build/docs/building/manage-dependencies) as dependencies to your build."]]