sincecutoff.com
← all changes

gh auth login supports expiring OAuth credentials

Introduced 2026-10-21 · score 0.98

HOW TO USE IT

When signing in with GitHub CLI v2.103.0 or later, use `gh auth login --expiring` to request refreshable credentials, or enable `expiring_credentials` to prefer them on every sign-in. For HTTPS Git, configure `gh` as the credential helper; fetch tokens with `gh auth token` when needed instead of caching them.

gh auth login --expiring
gh config set expiring_credentials enabled
gh auth setup-git

WHY THIS HELPS

Sign in to GitHub with credentials that expire and refresh automatically for CLI, API, and git operations.

REQUIREMENTS AND LIMITATIONS

  • Version: v2.103.0
  • Availability: Preview; available on github.com and GHE.com. Hosts that do not issue expiring credentials fall back to a regular non-expiring token.
  • --expiring: Prefer automatically refreshed expiring credentials if the host supports them; otherwise gh falls back to a regular token.
  • expiring_credentials: Configuration setting to prefer expiring credentials when logging in; allowed values are `enabled` or `disabled` (default `disabled`).
  • gh auth token: Prints the active account's token, refreshing an expired or near-expiry refreshable token first unless `--no-refresh` is given. Run it again each time a token is needed; do not cache its output.
  • GH_TOKEN / GITHUB_TOKEN: Environment-provided tokens are not refreshed.
  • git: For HTTPS operations, git 2.46 or newer allows gh to mark credentials non-cacheable; older git may let a caching helper reuse an expired token.
  • Prerequisite: Use GitHub CLI v2.103.0 or later; expiring tokens are supported on GitHub.com and GitHub Enterprise Cloud, subject to server support.
  • Prerequisite: For HTTPS Git operations, configure gh as the Git credential helper with `gh auth setup-git`; Git 2.46 or newer is recommended.
  • Expiring access tokens should not be cached; call `gh auth token` each time a token is needed.
  • Tokens supplied through `GH_TOKEN` or `GITHUB_TOKEN` are never refreshed.
  • For HTTPS git, the release advises git 2.46 or newer and configuring `gh` as the git credential helper with `gh auth setup-git` so git does not cache the token past its lifetime.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card