# GitHub: credentials

Under Connections, category Git, you connect a GitHub account via OAuth or a personal access token so MainPath can create or import repositories in your account and run pipelines there.

> Source: https://www.mainpath.ai/en/docs/github-credentials/

**GitHub** lives under **Connections** in the **Git** category. **Connect with GitHub** (OAuth) is the recommended path. If OAuth is unavailable, store a **personal access token**.

When you create or edit a project, the **Repositories** field at the bottom chooses git hosting: **Automatically generated (recommended)** keeps repositories on MainPath GitLab. **GitHub** uses the account you connected here.

## OAuth

1. Open **Connections → GitHub → Connect with GitHub**.
2. Sign in to GitHub and grant MainPath access to repositories, workflows, and organizations.
3. After the callback the connection is available in the project picker.

OAuth requires a GitHub OAuth app for MainPath (`GITHUB_OAUTH_CLIENT_ID` / `GITHUB_OAUTH_CLIENT_SECRET` on the backend). If that app is missing, only the token path remains.

## Personal access token

1. In GitHub, under **Settings → Developer settings → Personal access tokens**, create a token (classic or fine-grained) with repository, workflow, and package access.
2. Open **Connections → GitHub → Add API token**.
3. Enter **Name**, **Slug**, the token, and optionally the **GitHub URL** (default `https://github.com`; GitHub Enterprise differs).

MainPath checks the token against the GitHub API. For GitHub Enterprise, keep the base URL of your instance.

## Use it on a project

1. At the bottom of the project, choose **GitHub** and select this connection plus the organization or user namespace.
2. Per component you can import an existing repository or let MainPath create one.
3. MainPath writes `.github/workflows/ci.yml` that includes the public workflows from `doppelt-digital/app-project-github-actions`. GitHub-hosted runners (`ubuntu-24.04`, `macos-15`) install toolchain versions through ASDF.

GitOps lives in the same GitHub namespace (`gitops`).

