Source control your Salesforce metadata with GitHub Enterprise and Gearset

Matt Dickens on

Share with


When making the decision to version control your metadata, one of the first things you’ll need to figure out is where to host it. There are a variety of great options out there, but one of the first that’s likely to cross your mind is GitHub. Its ubiquity in the open source community and beyond not only means that it’s an incredibly well-documented platform supporting robustly exercised collaboration workflows, but it also means that most developers you meet will have certainly heard of GitHub and probably used it; the term “pull request” has entered into everyday developer parlance.

So GitHub’s a great choice for developer collaboration and hosted version control, and the good news is that Gearset already supports seamless integration with it. Unfortunately, having your source code hosted by a third party on servers that aren’t under your direct control can be prohibitive for some businesses, particularly in verticals like healthcare or finance where compliance is paramount.

Thankfully, GitHub Enterprise has you covered. In short, GitHub Enterprise (GHE) gives you all the functionality of GitHub packaged for convenient deployment to infrastructure under your direct control, on either AWS, Azure, or your own on-prem hardware.

Connecting Gearset and GitHub Enterprise

Gearset integrates with GitHub Enterprise. After setting up a GHE connection, you’ll be able to use all the functionality of Gearset’s GitHub integration with your GHE instance.

Step 1: Creating an OAuth app in GHE

To get started, you’ll first need to create an OAuth app in your GitHub Enterprise instance - this will let Gearset use OAuth to authorize against and talk to your GHE instance.

  1. First sign in to GHE and navigate to the Settings page, then OAuth applications

  2. From here, click the Developer applications tab and click Register a new application:

    Register a GHE OAuth app for Gearset
  3. You’ll need to fill in the settings - the Authorization callback URL needs to match the value below. Once you’ve filled in the settings click Register application:

    Configure a GHE OAuth app for Gearset
  4. Once that’s done, you’ll see a summary of the application, including a Client ID and Client Secret. These values, combined with the URL of your GHE instance, are what you’ll need to get Gearset and GHE talking to each other:

    The completed GHE Gearset OAuth app

Step 2: Connecting Gearset to GHE

All that remains is to pass the information from the last step above to Gearset.

  1. Navigate to the Manage orgs page in Gearset, and click Connect to GitHub Enterprise:

    Add a connection to GHE in Gearset
  2. In the resulting dialog, enter your GHE URL and the client ID and secret of your OAuth app from step 4 in the previous section, and click Connect:

    Configure the GHE connection in Gearset

This will initiate the OAuth flow and navigate you to GHE where you’ll be asked to approve Gearset’s access to your repositories.

And that’s all there is to it! If you navigate back to Compare and deploy, pick Source control as your metadata location and pick GitHub Enterprise as your source control type, you’ll find your GitHub Enterprise repos.

Get version control for Salesforce sorted

You can set up this integration on a free 30-day trial of Gearset. And if you’d like more guidance on version control for Salesforce, download our whitepaper on the subject.

Try all of Gearset for free