GH-AUTH-STATUS(1)

πŸ’… GH-AUTH-STATUS(1) β€” the GitHub CLI manual, bestie edition πŸŽ€

okay so this is gh-auth-status, straight out of the GitHub CLI manual, and it's genuinely the glow-up your terminal needs ✨


🌸 NAME 🌸

gh-auth-status β€” shows you the active account and the authentication state on every known GitHub host. it's giving "who am I and am I even logged in" energy 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

gh auth status [flags]

✨ DESCRIPTION ✨

So here's the tea: this command displays the active account and the authentication state on each known GitHub host πŸ’–

For every host, it tests the authentication state of each known account, and any issues it finds get included in the output. Each host section tells you which account is active β€” that's the one that gets used when you're targeting that host πŸ‘‘

If an account on any host has authentication issues β€” or, if you passed --hostname, just the one host you named β€” the command exits with 1 and writes to stderr. heads up though: when you use the --json option, it always exits with zero no matter what auth issues are lurking, unless there's a fatal error. no cap 😭

Wanna change the active account for a host? That's a whole other vibe β€” see gh auth switch 🧚


πŸŽ€ OPTIONS πŸŽ€

  • -a, --active β€” display the active account only. just the main character, nobody else πŸ’…
  • -h, --hostname <string> β€” check only a specific hostname's auth status. one host, one vibe check 🌈
  • --jq <expression> β€” filter the JSON output using a jq expression ✨
  • --json <fields> β€” output JSON with the specified fields πŸ”₯
  • -t, --show-token β€” display the auth token. yes, the actual token, in plain sight πŸ‘€
  • --template <string> β€” format the JSON output using a Go template; see gh help formatting πŸŽ€

πŸ“ JSON FIELDS πŸ“

  • hosts

πŸ’œ EXIT CODES πŸ’œ

  • 0: successful execution β€” slay βœ…
  • 1: error 😭
  • 2: command canceled πŸ™ˆ
  • 4: authentication required πŸ”
NOTE: specific commands may have additional exit codes. refer to that command's help for more info, iykyk πŸ’«

⭐ EXAMPLE ⭐

# Display authentication status for all accounts on all hosts
$ gh auth status

# Display authentication status for the active account on a specific host
$ gh auth status --active --hostname github.example.com

# Display tokens in plain text
$ gh auth status --show-token

# Format authentication status as JSON
$ gh auth status --json hosts

# Include plain text token in JSON output
$ gh auth status --json hosts --show-token

# Format hosts as a flat JSON array
$ gh auth status --json hosts --jq '.hosts | add'

🌈 SEE ALSO 🌈

  • gh-auth(1) β€” go read it, bestie, it's iconic πŸ‘‘

and that's the whole page, periodt πŸ’… this was GitHub CLI v2.102.0, dated Oct 2026 β€” mwah, go forth and check your auth status, you gorgeous nerd πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from