GitHub

Track and resolve bugs faster by using data from your GitHub commits, and streamline your triaging process by creating a GitHub issue directly from Sentry.

Install

  1. Navigate to Settings > Integrations > GitHub.

    Install GitHub integration

  2. If you have the legacy GitHub integration installed, use the button next to GitHub to Upgrade. If you don't have the legacy GitHub integration installed, use the button to Install.

  3. In the resulting modal, click "Add Installation".

  4. A GitHub install window should pop up. Click "Install".

  5. Select which repositories Sentry should have access to (or select all repositories).

  6. You should then be redirected back to the Sentry Integrations page.

  7. On your new GitHub instance in Sentry, click "Configure".

  8. Add any repositories from which you want to collect commit data. Make sure you have given Sentry access to these repositories in GitHub in the previous steps.

    Add repository

The GitHub integration is available for all projects under your Sentry organization. You can connect multiple GitHub organizations to one Sentry organization, but you cannot connect a single GitHub organization to multiple Sentry organizations.

GitHub Enterprise

Add new GitHub App

  1. Confirm Sentry's IP ranges are allowed for your GitHub Enterprise instance.

  2. In your GitHub Enterprise organization, navigate to Settings > Developer Settings > GitHub Apps and click to add a new New GitHub App.

    Create GitHub Enterprise app

Register new GitHub App

  1. First, you'll need to generate a webhook secret. For example, in terminal:

    Copied
    openssl rand -base64 500 | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1
  2. Then in GitHub, fill out the form as follows and click "Create GitHub App".

    GitHub App Name sentry-app
    Homepage URL https://sentry.io
    User authorization callback URL https://sentry.io/extensions/github-enterprise/setup/
    Setup URL https://sentry.io/extensions/github-enterprise/setup/
    Webhook URL https://sentry.io/extensions/github-enterprise/webhook/
    Webhook secret `Input your secret from the previous step`
    Repository Administration Read-only
    Commit Statuses No Access
    Deployments No Access
    Issues Read & Write
    Pages No Access
    Pull Requests Read-only
    Repository Contents Read-only
    Single File No Access
    Repository Projects No Access
    Organization members Read-only
    Organization projects No Access

    Subscribe to Events

    Pull Request Yes
    Push Yes

Install your GitHub App

  1. In Sentry, navigate to Organization Settings > Integrations.

  2. Next to GitHub Enterprise, click "Install".

    Install GitHub Enterprise integration

  3. Click "Add Installation".

    Add Installation

  4. Fill out the following form with information from your GitHub apps configuration page.

    GitHub Enterprise configuration form

    You'll need to generate a private key on your GitHub apps configuration page, and paste the entire contents into the GitHub App Private Key field.

    Generate private key

    For example, in terminal:

    Copied
    cat <YOUR_PRIVATE_KEY_FILE> | pbcopy
  5. Click "Configure" and then a GitHub install window will pop up. Select which repositories Sentry should have access to (or select all repositories) and click "Install".

    Install GitHub Enterprise confirmation modal

  6. You will then be redirected back to Sentry. On your new GitHub Enterprise instance, click "Configure".

    Configure GitHub enterprise

  7. Add any repositories that you want to collect commit data from. Make sure you have given Sentry access to these repositories in GitHub in the previous steps.

    Add GitHub Enterprise repository

GitHub Enterprise should now be enabled for all projects under your Sentry organization.

Configure

Use GitHub to track commits, identify suspect commits, resolve via commit or PR and manage issues.

Commit Tracking

Commit tracking allows you to hone in on problematic commits. Learn more about commit tracking.

Suspect Commits and Suggested Assignees

Once you set up commit tracking, you’ll be able to see the most recent changes to files found in the issue’s stack trace with suspect commits.

For issues where the files in the stack trace match files included in commits sent to Sentry, you’ll see the suspect commit, with a link to the commit itself.

Suspect commits

You’ll also see that the author of the suspect commit will be listed as a suggested assignee for this issue. To assign the issue to the suggested assignee, click on their icon.

Issue Management

Issue tracking allows you to create GitHub issues from within Sentry, and link Sentry issues to existing GitHub Issues.

Once you’ve navigated to a specific issue, you’ll find the Linked Issues section on the right hand panel. Here, you’ll be able to create or link GitHub issues.

Link GitHub issue to Sentry issue

Resolve via Commit or Pull Request

Once you are sending commit data, you can start resolving issues by including fixes <SENTRY-SHORT-ID> in your commit messages. For example, a commit message might look like:

Copied
Prevent empty queries on users

Fixes MYAPP-317

You can also resolve issues with pull requests by including fixes <SENTRY-SHORT-ID> in the title or description.

When Sentry sees this, we’ll automatically annotate the matching issue with a reference to the commit or pull request, and, later, when that commit or pull request is part of a release, we’ll mark the issue as resolved. The commit must be associated with a release. Otherwise, if the commit is squashed, Sentry won’t know when the commit has been released, and the issue may never be marked as a regression. With GitHub, we recommend using fixes <SENTRY-SHORT-ID> in the body of your pull request that is going to be merged to your main branch.

Stack Trace Linking

Stack trace linking takes you from a file in your Sentry stack trace to that same file in your source code. If you have commit tracking set up in Sentry, we can take you to the exact version (using the commit associated with the event) of the source code when the error occurred. Otherwise we'll link you to the current state of the source code (using the default branch).

  1. Navigate to Settings > Integrations > GitHub > Configurations.

  2. Click the "Configure" button next to your GitHub Instance.

  3. Click the Code Mappings tab.

  4. Set up a code mapping for each project for which you want to enable stack trace linking. To create a new code mapping, click Add Mapping.

  5. Fill out the form, then click Save Changes. Each form field is described below:

    • project (required): This is the Sentry project.

    • repo (required): This is the GitHub repository associated with the Sentry project above. If you have more than one GitHub repository being used per Sentry project, you'll need multiple code mappings.

    • branch (required): This is the default branch of your code we fall back to if you do not have commit tracking set up.

    • stack trace root and source code root (optional):

      1. If the file path in your Sentry stack trace frame matches the path to your source code, you do not need to set these values.

        • ex. For example, everything after the branch (main) matches the file path of code.py using a source code path of https://github.com/MeredithAnya/testing/blob/main/code.py so you don't need to set a stack trace root and source code root.
      2. If the filename in your Sentry stack trace frame doesn't match the path to your source code, you will need to replace the stack_root part of the filename with your source_root to make the filename match the source code path.

        • ex. For example, to get src/code.py to match code.py when the source code path is https://github.com/MeredithAnya/testing/blob/main/code.py, change the stack trace root to be set as src/, and leave source code root empty.

Code Owners

Import your existing GitHub CODEOWNERS files to automatically assign Sentry issues and route alerts to the responsible individuals and teams.

For more details, see the full documentation for Code Owners.

GitHub Single Sign-On

Single sign-on (or SSO) allows you to manage your organization’s entire membership via a third-party provider.

For more details, see the full documentation for Single Sign-on.

Troubleshooting

If you’re having issues adding a GitHub repository:

  • Make sure you are the Owner of your GitHub organization.
  • Disconnect, and then reconnect your GitHub Identity.

If you're having trouble setting up Sentry with your on-premises integration, verify the following:

  • The provided installation URL is a fully qualified domain name (FQDN), which is resolvable on the internet.
  • The IP addresses Sentry uses to make outbound requests are allowed.
  • Sentry's access to your installation URL is not path restricted.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").