Connect to a GitHub Enterprise repository

Stay organized with collections Save and categorize content based on your preferences.

This page explains how to connect a GitHub Enterprise repository to Cloud Build.

Before you begin

  • Enable the Cloud Build and Secret Manager APIs.

    Enable the APIs

  • Follow the instructions to connect a GitHub Enterprise host.
  • Ensure you have admin access on repositories that you want to enable GitHub Enterprise triggers for.

Connecting to a GitHub Enterprise repository

Console

To connect a GitHub Enterprise repository to a host connection, complete the following steps:

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

    Open the Repositories page

    You will see the Repositories page.

  2. Click Link Repositories to link repositories from your connection.

    You will see the Connect Repositories panel.

  3. In the Connect Repositories panel, enter the following information:

    1. Connection: Select a connection from the drop-down menu.
    2. Repository: Select a repository to link to your connection.

    3. Repository Name: Enter a name for your repository. You can only enter a repository name if you select a single repository in the previous step.

  4. Click Link to link your repository to your connection.

You have now successfully linked your GitHub Enterprise repository to your connection.

gcloud

To add a GitHub Enterprise repository to your connection, enter the following command:

   gcloud alpha builds repositories create REPO_NAME \
     --remote-uri=REPO_URI \
     --connection=CONNECTION_NAME --region=REGION

Where:

  • REPO_NAME is the name of your repository.
  • REPO_URI is the link to your GitHub repository.
  • CONNECTION_NAME is the name of your connection.
  • REGION is the region for your connection.

You have now linked a repository to your GitHub Enterprise connection.

Next steps