GitHub CLI Auth, Alias, and Config/Use GH_ENTERPRISE_TOKEN env var

Authenticate automation against GitHub Enterprise Server using env vars.

Section: Auth, Tokens, and Enterprise

Use GH_ENTERPRISE_TOKEN env var

bash
bash
export GH_HOST=github.example.com && export GH_ENTERPRISE_TOKEN=token
Explanation

Authenticate automation against GitHub Enterprise Server using env vars.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Auth, Tokens, and Enterprise
Set default host env var
Set the default host for gh commands.
OpenIn sheetbashsame section
Print active auth token
Print the active token for scripting.
OpenIn sheetbashsame section
Switch active account
Switch between authenticated accounts on a host.
OpenIn sheetbashsame section
Configure Git protocol auth
Configure Git to use GitHub CLI as a credential helper.
OpenIn sheetbashsame section
Authenticate with token from stdin
Authenticate non-interactively using a token piped from stdin.
OpenIn sheetbashsame section
Set GH_REPO for scripts
Set the default repository context for scripts.
OpenIn sheetbashsame section