---
title: Github Code References
description: "Connect Statsig with GitHub to surface code references for feature gates and dynamic configs, so you can see exactly where each flag is used."
product: general
token_estimate: 690
---
# Github Code References

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

> **Warning:**
>
> ### Deprecated: PAT-based integration
>
> Statsig has deprecated the Personal Access Token (PAT) based integration in favor of the new GitHub App-based integration. The new integration provides improved security and functionality, including AI-powered features like Knowledge Graph. Migrate to the [GitHub AI Integration](https://docs.statsig.com/integrations/github-ai-integration) for the best experience.

## How the GitHub integration works

The Statsig GitHub Integration lets you find [Feature Gate](https://docs.statsig.com/feature-flags/overview) and [Dynamic Config](https://docs.statsig.com/dynamic-config/overview) references within your codebase on the Statsig Console. The integration uses the GitHub API to access only Feature Gate or Dynamic Config references and doesn't store any sensitive information.

## Configure GitHub code references

Create a new GitHub developer token, either Classic or Fine Grained, with at least read access to the organization or repositories where you use Statsig. Find this in GitHub under _Settings > Developer Settings > Personal Access Token_.

Then, log in to the Statsig Console and navigate to the GitHub Code References integration on the Integrations page. Find this in _Project Settings > Integrations Tab > Github Code References_.

The integration provides instructions on how to enable GitHub Code References.

![GitHub integration configuration interface](https://docs.statsig.com/images/github_code_references/github_integration.png)

After you enter your token and organization name, Statsig verifies it can access repositories and notifies you of any problems.

Navigate to the Feature Gates or Dynamic Configs pages on the Statsig Console and select a gate or dynamic config. Under the _Diagnostics_ tab, select the **View Code References** link to see your code references.

![Feature gate diagnostics tab showing code references link](https://docs.statsig.com/images/github_code_references/feature_gate_view.png)

Code References appear based on the feature gate or dynamic config page you're on. You can filter Code References by repository and file extension.

![Code references panel listing repositories and files](https://docs.statsig.com/images/github_code_references/code_references.png)

### Github code references action

A [GitHub Action](https://github.com/statsig-io/github-code-references) is also available. It can scan your repositories for gates and dynamic configs, then create a PR replacing [Stale Gates](https://docs.statsig.com/feature-flags/permanent-and-stale-gates).

