Scroll to navigation

GH-AUTH-STATUS(1) GitHub CLI manual GH-AUTH-STATUS(1)

NAME

gh-auth-status - Display active account and authentication state on each known GitHub host

SYNOPSIS

gh auth status [flags]

DESCRIPTION

Display active account and authentication state on each known GitHub host.

For each host, the authentication state of each known account is tested and any issues are included in the output. Each host section will indicate the active account, which will be used when targeting that host.

If an account on any host (or only the one given via --hostname) has authentication issues, the command will exit with 1 and output to stderr. Note that when using the --json option, the command will always exit with zero regardless of any authentication issues, unless there is a fatal error.

To change the active account for a host, see gh auth switch.

OPTIONS

Display the active account only

Check only a specific hostname's auth status

Filter JSON output using a jq expression

Output JSON with the specified fields

Display the auth token

Format JSON output using a Go template; see "gh help formatting"

JSON FIELDS

hosts

EXIT CODES

0: Successful execution

1: Error

2: Command canceled

4: Authentication required

NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

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)

Oct 2025 GitHub CLI v2.82.1