Link a GitHub repository to a project (BETA)

APPLICABLE PRODUCTS
  • Sales Hub
    • Enterprise
  • Service Hub
    • Enterprise

Connect a GitHub account to HubSpot to automatically trigger a new project build when your team pushes a change to an associated GitHub repository. You can then use familiar GitHub tools and workflows to streamline development on your project. Follow the instructions below to create a new project and associate it with an existing GitHub repository.

Before you link your repository, make sure you've run hs project create in the root directory of your repository, and you've committed and pushed the resulting code to GitHub. You can use the getting started project template as a reference for the proper directory structure. If you're creating a project for the first time, check out the setup guide to help you configure your local environment.

To link your GitHub repository to a new project:

  • In your HubSpot account, navigate to CRM Development.
  • In the left sidebar menu, select Projects.
  • In the top right, click New project.
  • In the dialog box, select Project from GitHub, then click Connect to GitHub.
  • Log into your GitHub account, then authorize the HubSpot Projects integration:
    • To grant HubSpot full access to all repositories in your account, select All repositories. If you only want to link a single repository to a project, select Only select repositories, then select a repository. After you've installed the integration, you can always authorize other repositories if needed by updating repository access in the HubSpot Projects application configuration in your GitHub account settings.
    • Click Install & Authorize.

hs-projects-authorize-gh-integration

  • Back in HubSpot, in the dialog box, select the radio button next to the repository you want to link to your new project. 
  • Click the Select branch dropdown menu and select a branch that will trigger new builds when you or a team member pushes a change.
  • Click Link GitHub repo.

hs-projects-confirm-gh-repo

Once linked, HubSpot will create a new build of your project any time someone pushes a change to the repository. If you've turned on auto-deploy, the project will be deployed after the build completes.

hs-projects-gh-integration-build-details-tab

Please note:

  • When a project is linked to a GitHub repository, team members cannot upload code directly to the project using the HubSpot CLI.
  • After linking a GitHub repository, if you upgrade your GitHub plan to Enterprise and enforce SAML SSO, you'll need to reauthorize the HubSpot connection. Otherwise, HubSpot will not be able to retrieve existing project repositories or link new ones. Learn more about SAML SSO for GitHub Enterprise.

In addition to creating a new project from an existing repository, you can also link an existing project to a repository. To link a GitHub repository to a project:

  • In your HubSpot account, navigate to CRM Development.
  • In the left sidebar menu, select Projects.
  • In the project, click the Settings tab.
  • Under GitHub connection, click Link now
    link-github-repo
  • In the right sidebar, select the repository and branch to connect to, then click Link GitHub repo.

To unlink a GitHub repository from one of your projects:

  • In your HubSpot account, navigate to CRM Development.
  • In the left sidebar menu, select Projects.
  • Click the name of a project.
  • Click the Settings tab.
  • Under GitHub Connection, click Unlink project from GitHub.

hs-projects-unlink-project-from-github

  • In the dialog box, click Unlink project.

Uninstall the HubSpot app in your GitHub account

To fully disconnect GitHub from your HubSpot account:

  • In your HubSpot account, navigate to Settings.
  • In the left sidebar menu, navigate to IntegrationsConnected Apps.
  • On the GitHub integration tile, click Actions, then select Uninstall.

The GitHub account will then be disconnected from the account, unlinking any projects in the account that have been linked to the connected branch. Commits to the branch will no longer trigger new builds in HubSpot.


Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.