<commit_before># GitHub Enterprise

Buildkite can connect to your GitHub Enterprise installation and use the Commit Status API to update the status of commits in Pull Requests.

{:toc}

## Step 1. Register Buildkite as an OAuth App

<div class="Docs__note">
<p>This guide was written using GitHub Enterprise version 2.16.3. Earlier or later versions may have different menus and headings for the OAuth app registration. All of the Buildkite settings will remain the same.</p>
</div>

In your GitHub Enterprise organization settings, click on the 'OAuth Apps' menu item under 'Developer Settings':

<%= image "oauth-apps-developer-settings.png", width:2038/2, height:1395/2, alt:"Screenshot of the OAuth Apps Page in the Developer Settings Menu" %>

Click **Register an application**. Fill out the form with the following values:

* Name: `Buildkite`
* URL: `https://buildkite.com`
* Callback URL: `https://buildkite.com/user/authorize/github_enterprise/callback`

<%= image "register-oauth-application-form.png", width:1548/2, height:1107/2, alt:"Screenshot of the form to Register an OAuth Application" %>

Click the **Register application** button at the bottom of the form.

After sucessfully registering your application, you can optionally add a logo to your app. Here is a pre-cropped image you can use:

<%= image "buildkite-square.png", width:350/2, height:350/2, alt:"Buildkite Logo" %>

Make a note of your Client ID and Client Secret, you will need those to connect your GitHub Enterprise installation with Buildkite in the next step.

<%= image "client-id-and-secret.png", width:767/2, height:707/2, alt:"Screenshot of the Client ID and Client Secret section of the Buildkite OAuth App settings page" %>

## Step 2. Update your Buildkite organization settings

Go to the <a href="https://buildkite.com/organizations/-/settings" rel="nofollow">Organization Settings</a> page of the Buildkite organization you'd like to connect to your GitHub Enterprise installation:

<%= image "buildkite-organization-settings.png", width:1704/2, height:93/2, alt:"Screenshot of the Buildkite menu bar with the organization settings link selected" %>

Scroll down to the **GitHub Enterprise** settings section. 
The form requires:

- The Client ID and Client Secret from the GitHub OAuth App you created in Step 1, and
- The base URL of your GitHub Enterprise Installation

If you're using self-signed certificates, make sure the 'Verify TLS Certificate' checkbox is not checked. 

Press **Save GitHub Enterprise Settings** to save your settings. After saving, the 'Secret' field will appear blank - it has been saved and will not be displayed on Buildkite.com.

<%= image "buildkite-github-enterprise-settings.png", width:1738/2, height:1216/2, alt:"Screenshot of the GitHub Enterprise settings section in Buildkite" %>

You can optionally supply a TLS certificate pair to be used by Buildkite as a client certificate when contacting your GitHub Enterprise endpoints.

<%= image "tls-client-certificate.png", width:1726/2, height:787/2, alt:"Screenshot of the TLS client settings section of the GitHub Enterprise settings in Buildkite" %>

## Step 3. Connect your GitHub Enterprise account to Buildkite

For Buildkite to mark commits and pull requests as pass or fail, you'll need to authorize your GitHub Enterprise user account with Buildkite.

In your Buildkite Personal Settings, click on the <a href="<%= url_helpers.user_authorizations_url %>" rel="nofollow">Connected Apps</a> menu item. Here you'll see your GitHub Enterprise Installation along with any other connected apps. Click **Connect**:

<%= image "buildkite-connected-apps-settings.png", width:1960/2, height:622/2, alt:"Screenshot of the Connected Apps page in Buildkite Personal Settings with the GitHub Enterprise App" %>

You will be redirected back to your GitHub Enterprise Installation, where it will ask you to authorize your new Buildkite OAuth app to use your GitHub Enterprise account. Click **Authorize** to complete your setup:

<%= image "authorize-buildkite.png", width:1128/2 , height:1392/2, alt:"Screenshot of the Authorization page in GitHub Enterprise" %>

That's it! Next time you create a pipeline with a repository that's either `https://git.mycompany.com/acme-inc/app.git` or `<EMAIL>:acme-inc/app.git`,
Buildkite will recognize that it's hosted on your GitHub Enterprise Installation, and use your newly created OAuth authorization to update the commit statuses.

## Firewalled installs

If your GitHub Enterprise is behind a firewall you’ll need to allow Buildkite’s IP address so we can perform oAuth authentications use GitHub Enterprise API to update your pull request statuses.

All Buildkite network traffic to your GitHub Enterprise install will come from the following IP address: `172.16.58.3`. Please configure your network to allow traffic from this IP address.
<commit_msg>Fix typo of OAuth<commit_after># GitHub Enterprise

Buildkite can connect to your GitHub Enterprise installation and use the Commit Status API to update the status of commits in Pull Requests.

{:toc}

## Step 1. Register Buildkite as an OAuth App

<div class="Docs__note">
<p>This guide was written using GitHub Enterprise version 2.16.3. Earlier or later versions may have different menus and headings for the OAuth app registration. All of the Buildkite settings will remain the same.</p>
</div>

In your GitHub Enterprise organization settings, click on the 'OAuth Apps' menu item under 'Developer Settings':

<%= image "oauth-apps-developer-settings.png", width:2038/2, height:1395/2, alt:"Screenshot of the OAuth Apps Page in the Developer Settings Menu" %>

Click **Register an application**. Fill out the form with the following values:

* Name: `Buildkite`
* URL: `https://buildkite.com`
* Callback URL: `https://buildkite.com/user/authorize/github_enterprise/callback`

<%= image "register-oauth-application-form.png", width:1548/2, height:1107/2, alt:"Screenshot of the form to Register an OAuth Application" %>

Click the **Register application** button at the bottom of the form.

After sucessfully registering your application, you can optionally add a logo to your app. Here is a pre-cropped image you can use:

<%= image "buildkite-square.png", width:350/2, height:350/2, alt:"Buildkite Logo" %>

Make a note of your Client ID and Client Secret, you will need those to connect your GitHub Enterprise installation with Buildkite in the next step.

<%= image "client-id-and-secret.png", width:767/2, height:707/2, alt:"Screenshot of the Client ID and Client Secret section of the Buildkite OAuth App settings page" %>

## Step 2. Update your Buildkite organization settings

Go to the <a href="https://buildkite.com/organizations/-/settings" rel="nofollow">Organization Settings</a> page of the Buildkite organization you'd like to connect to your GitHub Enterprise installation:

<%= image "buildkite-organization-settings.png", width:1704/2, height:93/2, alt:"Screenshot of the Buildkite menu bar with the organization settings link selected" %>

Scroll down to the **GitHub Enterprise** settings section.
The form requires:

- The Client ID and Client Secret from the GitHub OAuth App you created in Step 1, and
- The base URL of your GitHub Enterprise Installation

If you're using self-signed certificates, make sure the 'Verify TLS Certificate' checkbox is not checked.

Press **Save GitHub Enterprise Settings** to save your settings. After saving, the 'Secret' field will appear blank - it has been saved and will not be displayed on Buildkite.com.

<%= image "buildkite-github-enterprise-settings.png", width:1738/2, height:1216/2, alt:"Screenshot of the GitHub Enterprise settings section in Buildkite" %>

You can optionally supply a TLS certificate pair to be used by Buildkite as a client certificate when contacting your GitHub Enterprise endpoints.

<%= image "tls-client-certificate.png", width:1726/2, height:787/2, alt:"Screenshot of the TLS client settings section of the GitHub Enterprise settings in Buildkite" %>

## Step 3. Connect your GitHub Enterprise account to Buildkite

For Buildkite to mark commits and pull requests as pass or fail, you'll need to authorize your GitHub Enterprise user account with Buildkite.

In your Buildkite Personal Settings, click on the <a href="<%= url_helpers.user_authorizations_url %>" rel="nofollow">Connected Apps</a> menu item. Here you'll see your GitHub Enterprise Installation along with any other connected apps. Click **Connect**:

<%= image "buildkite-connected-apps-settings.png", width:1960/2, height:622/2, alt:"Screenshot of the Connected Apps page in Buildkite Personal Settings with the GitHub Enterprise App" %>

You will be redirected back to your GitHub Enterprise Installation, where it will ask you to authorize your new Buildkite OAuth app to use your GitHub Enterprise account. Click **Authorize** to complete your setup:

<%= image "authorize-buildkite.png", width:1128/2 , height:1392/2, alt:"Screenshot of the Authorization page in GitHub Enterprise" %>

That's it! Next time you create a pipeline with a repository that's either `https://git.mycompany.com/acme-inc/app.git` or `git@git.mycompany.com:acme-inc/app.git`,
Buildkite will recognize that it's hosted on your GitHub Enterprise Installation, and use your newly created OAuth authorization to update the commit statuses.

## Firewalled installs

If your GitHub Enterprise is behind a firewall you’ll need to allow Buildkite’s IP address so we can perform OAuth authentications use GitHub Enterprise API to update your pull request statuses.

All Buildkite network traffic to your GitHub Enterprise install will come from the following IP address: `172.16.58.3`. Please configure your network to allow traffic from this IP address.

{'fraction_non_alphanumeric': 0.07959434542102028, 'fraction_numerical': 0.020077852898996107, 'mean_word_length': 5.048946716232962, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1358728', 'n_tokens_mistral': 2839, 'n_tokens_neox': 2571, 'n_words': 1249}