Keys / GitHub CLI

GH_TOKEN

The GitHub token the GitHub CLI (gh) uses instead of its stored login, in scripts and CI.

Expires
you choose, or never
API
none; dashboard only

Get it

Create one on github.com/settings/personal-access-tokens/new. The steps aren't recorded yet.

Set it

GH_TOKEN=...

gh reads it before GITHUB_TOKEN for github.com and ghe.com, and it takes precedence over a stored login. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Create a new fine-grained token with the same repositories and permissions, or a classic token with the same scopes.
  2. Deploy it everywhere that reads GH_TOKEN.
  3. Check that nothing still uses the old token, then delete it under Developer settings > Personal access tokens.
  4. In GitHub Actions, set GH_TOKEN: ${{ github.token }}. That token is new for every job.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16