commands.sh

gh auth

all

Authenticate with a GitHub host.

More info →

Options (2)

-h, --hostnameboolean

Log in with a specific GitHub Enterprise Server

Example: gh auth login {{[-h|--hostname]}} {{github.example.com}}
-s, --scopesboolean

Expand the permission scopes

Example: gh auth refresh {{[-s|--scopes]}} {{repo,admin:repo_hook,admin:org,admin:public_key,admin:org_hook,...}}

Examples (7)

Log in with interactive prompt

Log in with a token from `stdin` (created in <https://github.com/settings/tokens>)

echo your_token | gh auth login --with-token

Check if you are logged in

gh auth status

Log in with a specific GitHub Enterprise Server

gh auth login [-h|--hostname] github.example.com

Refresh the session to ensure authentication credentials have the correct minimum scopes (removes additional scopes requested previously)

gh auth refresh

Expand the permission scopes

gh auth refresh [-s|--scopes] repo,admin:repo_hook,admin:org,admin:public_key,admin:org_hook,...
made by @shridhargupta | data from tldr-pages