Repository navigation
Description
Describe the bug
gh auth status reports SSH as the configured protocol for git operations, and hosts.yml contains no token. This creates a false impression that removing SSH keys and revoking PATs is sufficient to de-authorize a machine. In reality, gh stores its OAuth token (gho_*) silently in the system Keychain under gh:github.com, which survives all of those steps.
A user who wants to fully revoke local access has no visible indicator that the Keychain entry exists or that gh auth logout is the only reliable way to remove it.
Affected version
It's designed this way since 2023 (v2.32.1 specifically).
Steps to reproduce the behavior
- Run
gh auth loginwith SSH as the git protocol - Confirm
hosts.ymlhas nooauth_tokenfield - only user/protocol metadata - Revoke all PATs at github.com/settings/tokens
- Remove SSH keys from
~/.ssh/ - Run
gh gist listor any API-backed command - Observe that it still authenticates successfully
Expected vs actual behavior
Expected: Either gh auth status surfaces the Keychain-stored token clearly (e.g. ✓ Token stored in: system keychain (gh:github.com)), or the security log / PAT revocation flow warns that a separate CLI OAuth token may still be active on the machine.
Actual: The token is invisible to the user. gh auth status only shows Token: gho_**** without indicating where it comes from. Nothing in GitHub's security UX (PAT revocation, SSH key removal, hosts.yml inspection) reveals the token or prompts the user to revoke it via gh auth logout.
Logs
❯ cat ~/.config/gh/hosts.yml
github.com:
git_protocol: ssh
users:
ruyrocha:
user: ruyrocha
❯ security find-generic-password -s "gh:github.com" -w
go-keyring-base64:[TOKEN]
❯ gh gist list | head -1
# still works after removing SSH keys and revoking all PATsRelated issues
- gh auth logout does not erase and/or revoke OAuth token in MacOS Keychain #13111 -
gh auth logoutdoes not erase the OAuth token from macOS Keychain. Related but distinct: assumes the user already knows to rungh auth logout. This issue is about the prior step — nothing surfaces that the Keychain token exists in the first place. gh apisilently sends unauthenticated requests when keychain access fails #13317 -gh apisilently sends unauthenticated requests when Keychain lookup fails. Related but distinct: concerns a broken auth path; this issue concerns a working but invisible auth path that survives all conventional de-authorization steps.gh auth loginshould error if the system keyring is unavailable rather than falling back to insecure storage #10108 - silent fallback to insecure storage with no warning to the user. Same area of auth transparency.- Invalidate previous OAuth token when a new one is generated with
gh auth#9233 - old OAuth tokens not revoked on re-auth, leaving stale credentials in the user's account.
Activity
williammartin commentedon May 2, 2026
Hey, thanks for the report. Can you share your
gh auth statusin the case whee you're not seeing any indication of the keyring?Open to discussing ways to make something like this clearer (like putting it by the token), but just from your report I can't tell whether you missed this or there's something strange going on.
zahraazizi5856-art commentedon May 3, 2026
ruyrocha commentedon May 4, 2026
hey @williammartin looks like the issue was solved already, so I'm closing this. Thank you for the inputs here!