See all news
Image: GitHub Changelog
GitHub Changelog
Development & DevOps

Goodbye to everlasting tokens! GitHub CLI tests credentials that renew themselves

GitHub CLI now lets users sign in with short-lived OAuth tokens that refresh automatically. The opt-in preview is available starting with GitHub CLI 2.103.0. The change shortens the exposure window for leaked credentials, though scripts that store tokens for long-term reuse may need adjustments. For DevOps teams, it is a concrete improvement in day-to-day identity management.

Persistent authentication comes at a security cost. Many developers keep access credentials for long periods to avoid signing in repeatedly. When a token is accidentally leaked in a log, script or file, it can remain useful to an attacker until someone revokes it. GitHub aims to reduce that risk with expiring access tokens and rotating refresh credentials.

The option can already be tested. Starting with GitHub CLI 2.103.0, the gh auth login --expiring command requests this scheme. It can also be enabled by default with gh config set expiring_credentials enabled. GitHub recommends running gh auth setup-git if Git uses HTTPS and upgrading to Git 2.46 or later to prevent credentials from being stored longer than they should. The feature is still optional and compatible with the previous sign-in method. Workflows that copy the output of gh auth token once will need to be adapted to request an updated token when they need it.

At a glance

WhatGitHub CLI added preview support for OAuth tokens that expire and renew automatically, with the goal of reducing the risk of leaked credentials.
WhenThe improvement was announced on October 21, 2026, and is available starting with GitHub CLI version 2.103.0.
WhereIt works on github.com and ghe.com; GitHub Enterprise Server can issue these tokens starting with version 3.23, according to the official documentation.
HowIt is enabled with `gh auth login --expiring` or through configuration; GitHub CLI manages the refresh token and renews access when needed.
WhyLong-lived tokens increase the potential damage of a leak; automatic expiration limits their usefulness without requiring constant manual authentication.

Build your digital presence

Start today: write to us and we’ll reply within 24 hours.