gh auth status
Confirm who you're signed in as
gh auth status reports which GitHub accounts gh is signed into, the active account, the authentication protocol, and the token's scopes. It's the first command to run when a gh command unexpectedly fails with a permissions error.
gh auth statusSyntax
gh auth status [flags]Examples
Show authentication status for all hosts
gh auth statusCheck a specific GitHub Enterprise host
gh auth status --hostname github.example.comReveal the token value
gh auth status --show-tokenOnly show the active account
gh auth status --activeOptions & flags
| Flag | What it does |
|---|---|
| -h, --hostname | Check a specific host (e.g. a GitHub Enterprise server). |
| -t, --show-token | Display the authentication token. |
| -a, --active | Show only the active account for each host. |
How to use gh auth status, step by step
- Run
gh auth status. - Confirm the account, protocol (HTTPS or SSH), and token scopes.
- If scopes are missing, refresh them with
gh auth refresh -s scope. - If you're not logged in, run
gh auth login.
Common errors and fixes
You are not logged into any GitHub hosts. Run gh auth login to authenticate.
Exactly what it says — run gh auth login and follow the prompts to sign in.
X github.com: the token in ... is invalid
Your stored token expired or was revoked. Re-authenticate with gh auth login to replace it.
Related commands
Frequently asked questions
How do I check if I'm logged into GitHub CLI?
Run gh auth status. It lists each host you're authenticated to, the active account, the protocol, and the token scopes. If nothing is logged in, it tells you to run gh auth login.
How do I see my token scopes?
gh auth status prints the granted scopes for each account. If a command fails on permissions, this is where you confirm the scope is present, then add it with gh auth refresh.
How do I check authentication for a GitHub Enterprise host?
Pass --hostname: gh auth status --hostname github.example.com shows the status for that specific server.