Connecting a GitHub Enterprise Server repository as your source

Last modified: March 14th, 2023

Connecting to your GitHub Enterprise Server allows you to work on your websites locally and have the changes synced to CloudCannon. File changes made on CloudCannon also get synced back to your GitHub Enterprise Server repository.

To connect to a GitHub.com repository instead, follow the instructions listed for GitHub.

Creating a GitHub App#

Before configuring your GitHub Enterprise Server, you need to Create a new GitHub App. You only need to do this once per server. We recommend creating the App under a GitHub Organisation.

  1. On your GitHub Enterprise Server instance, navigate to Settings > Developer Settings > GitHub Apps and select New GitHub App.

  2. Fill the Register new GitHub App with the following:

    • GitHub App name: CloudCannon
    • Homepage URL: https://app.cloudcannon.com
    • Callback URL: https://app.cloudcannon.com/github_enterprise_server/authorize
    • Setup URL: https://app.cloudcannon.com/github_enterprise_server/install
    • Redirect on update: true
    • Webhook URL: https://app.cloudcannon.com/hooks/github_enterprise_server/{organization_id} (The organization specific URL can be found on CloudCannon / Organization / Settings / GitHub Enterprise Server)
    • Webhook secret: A random string with high entropy
  3. Set the Permissions as follows:

    • Repository permissions
      • Commit statuses: Read and Write
      • Contents: Read and Write
      • Metadata: Read-only
      • Pull requests: Read and Write
    • User permissions
      • Email addresses: Read-only
  4. Under Subscribe to events select the following events:

    • Meta
    • Push
  5. Choose the best option for your team on the Where can this GitHub App be installed? option.

Generate client secret and private key#

After creating your GitHub App, you will be able to generate a client secret and a Private Key. Those keys along with other details will be used to authenticate CloudCannon requests on your GitHub Enterprise Server.

  1. Under General settings select Generate a new client secret. Make sure you copy the generated secret to be used later.
  2. Under General settings select Generate a private key. This will generate a PEM file and will be automatically downloaded. Keep this in a safe place to be used later.

Configuring your GitHub Enterprise Server#

Before syncing with a repository in your GitHub Enterprise Server, you need to configure your instance on CloudCannon. You only need to do this once per account. To connect to your GitHub Enterprise Server instance:

  1. Go to Settings / GitHub Enterprise Server
  2. Enter the details for your GitHub Enterprise Server instance:
    • Endpoint: The URL where your instance can be accessed.https://HOSTNAME
    • Authorize URL: https://HOSTNAME/login/oauth/authorize
    • Token URL: https://HOSTNAME/login/oauth/access_token
    • GitHub App ID: Values assigned by GitHub.
    • GitHub App Name: CloudCannon (The same name used when creating the App in the Creating a GitHub App step)
    • Client ID: Values assigned by GitHub.
    • Client Secret: Previously generated
    • WebHook Secret: The random string with high entropy previously generated.
    • Private Key: Contents of the PEM file previously generated.
  3. Click Configure GitHub Enterprise Server
Configuring your GitHub Enterprise Server

Syncing with a repository#

To connect a GitHub Enterprise Server repository and start syncing files, follow these instructions:

  1. Go to Site Settings / Source Syncing
  2. Select GitHub Enterprise Server repository
  3. Click Authenticate
Selecting GitHub Enterprise Server as the your source syncing provider

From there you can follow the same instructions as configuring a GitHub.com repository.

Related Articles

Open in a new tab