snippetbashTip
gh auth — Authenticate with a GitHub host. More information: <https://cli.github.com/manual/gh_auth>.
Viewed 0 times
commandgh authgithubcliwithauthenticatehostmore
Problem
How to use the
gh auth command: Authenticate with a GitHub host. More information: <https://cli.github.com/manual/gh_auth>.Solution
gh auth — Authenticate with a GitHub host. More information: <https://cli.github.com/manual/gh_auth>.Log in with interactive prompt:
gh auth loginLog in with a token from
stdin (created in <https://github.com/settings/tokens>):echo {{your_token}} | gh auth login --with-tokenCheck if you are logged in:
gh auth statusLog out:
gh auth logoutLog 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 refreshExpand the permission scopes:
gh auth refresh {{[-s|--scopes]}} {{repo,admin:repo_hook,admin:org,admin:public_key,admin:org_hook,...}}Code Snippets
Log in with interactive prompt
gh auth loginLog in with a token from `stdin` (created in <https://github.com/settings/tokens>)
echo {{your_token}} | gh auth login --with-tokenCheck if you are logged in
gh auth statusLog out
gh auth logoutLog in with a specific GitHub Enterprise Server
gh auth login {{[-h|--hostname]}} {{github.example.com}}Context
tldr-pages: common/gh auth
Revisions (0)
No revisions yet.