Connect a source code repository

Developer Connect lets you integrate with third-party source code repositories so you can use them in supported Google products. For example, you can link a GitHub repository and use it to develop apps with Firebase App Hosting.

This quickstart shows you how to:

  • Initiate a connection to GitHub
  • Link to a repository hosted on GitHub.com

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Developer Connect and Secret Manager APIs.

    Enable the APIs

  5. Make sure that you have the following role or roles on the project: Developer Connect Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find the row that has your email address.

      If your email address isn't in that column, then you do not have any roles.

    4. In the Role column for the row with your email address, check whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your email address.
    5. In the Select a role list, select a role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Make sure that billing is enabled for your Google Cloud project.

  8. Enable the Developer Connect and Secret Manager APIs.

    Enable the APIs

  9. Make sure that you have the following role or roles on the project: Developer Connect Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find the row that has your email address.

      If your email address isn't in that column, then you do not have any roles.

    4. In the Role column for the row with your email address, check whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your email address.
    5. In the Select a role list, select a role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  10. Make sure that you have a GitHub account and access to a repository hosted on GitHub.com. Or, follow the GitHub documentation to create new ones:
  11. If you're using an existing repository and you aren't the owner, ask the owner to grant admin-level permissions to the repository. If the repository is in a GitHub organization, request admin-level permissions from the organization owner. To learn more about GitHub organizations, see GitHub account types.

Initiate a connection

  1. Open the Developer Connect page in the Google Cloud console.

    Go to Developer Connect

  2. Click the Connections tab.

  3. Click Create connection and choose GitHub.

  4. Choose us-central1 as the region.

  5. Enter quickstart-connection as the name.

  6. Click Continue.

    The Google Developer Connect dialog appears requesting authorization to use your GitHub OAuth token.

    If you don't see a dialog, turn off any pop-up blocking browser plug-ins and makes sure that your browser settings allow pop-ups. For example, in Chrome, follow the instructions to allow pop-ups.

  7. Click I understand and continue.

  8. Complete the GitHub account sign-in steps if prompted to do so.

  9. Click Authorize Developer Connect if prompted to do so. If you don't see this prompt, authorization has already been granted on this account.

Configure the connection

Grant permissions on your GitHub account and repositories using the following steps. The prompts depend on whether someone using the GitHub account has already installed the Google Developer Connect app in GitHub.

  • If you see a list of GitHub accounts: You don't have the app installed yet. Install and configure it by following these steps:

    1. Choose the GitHub account that has access to the repository you want to link.

    2. Specify GitHub repository permissions and install the app. For more information, see the GitHub instructions on installing apps.

  • If you see a prompt to re-use an existing installation: Choose where to install and configure the app by following these steps:

    1. Click GitHub Account to see accounts that have the app installed. If you see the account you want to use, choose it.

      1. Click Confirm.
    2. If you don't see the account that you want to use, choose Install the GitHub App on another GitHub account.

      1. Click Confirm.

      2. Choose the GitHub account you want to use.

      3. Specify GitHub repository permissions and install the app. For more information, see the GitHub instructions on installing apps.

  1. In Repositories, choose the repository you want to link.

  2. Click Link.

The connection is added to the connections list, and the linked repository is added to the repository list.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

  1. In the Google Cloud console, go to the Developer Connect page.

    Go to Developer Connect

  2. In the Repositories tab, in the row containing the name of the linked repository, click More options.

  3. Choose Unlink.

  4. Click Confirm.

  5. Click the Connections tab.

  6. In the row containing the name of your connection, click More options.

  7. Choose Delete.

  8. Enter the name of your connection.

  9. Click Confirm.

Deleting connections and links doesn't delete the repositories on GitHub.com. If you created a new GitHub repository for this quickstart and you want to delete the repository, follow the GitHub instructions to delete a repository.

If you want to uninstall the Google Developer Connect app, follow the GitHub instructions on modifying installed apps.

What's next