2025-03-14 21:59:59 -06:00
|
|
|
# gh auth
|
|
|
|
|
|
|
|
|
|
> Authenticate with a GitHub host.
|
|
|
|
|
> More information: <https://cli.github.com/manual/gh_auth>.
|
|
|
|
|
|
|
|
|
|
- Log in with interactive prompt:
|
|
|
|
|
|
|
|
|
|
`gh auth login`
|
|
|
|
|
|
|
|
|
|
- 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 out:
|
|
|
|
|
|
|
|
|
|
`gh auth logout`
|
|
|
|
|
|
|
|
|
|
- Log in with a specific GitHub Enterprise Server:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`gh auth login {{[-h|--hostname]}} {{github.example.com}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Refresh the session to ensure authentication credentials have the correct minimum scopes (removes additional scopes requested previously):
|
|
|
|
|
|
|
|
|
|
`gh auth refresh`
|
|
|
|
|
|
|
|
|
|
- Expand the permission scopes:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`gh auth refresh {{[-s|--scopes]}} {{repo,admin:repo_hook,admin:org,admin:public_key,admin:org_hook,...}}`
|