2020-10-26 10:14:22 +00:00
|
|
|
# gh auth
|
|
|
|
|
|
|
|
> Authenticate with a GitHub host from the command line.
|
|
|
|
> More information: <https://cli.github.com/manual/gh_auth>.
|
|
|
|
|
2021-05-14 01:42:15 +01:00
|
|
|
- Log in with interactive prompt:
|
2020-10-26 10:14:22 +00:00
|
|
|
|
|
|
|
`gh auth login`
|
|
|
|
|
2021-05-14 01:42:15 +01:00
|
|
|
- Log in with a token from standard input (created in https://github.com/settings/tokens):
|
2020-10-26 10:14:22 +00:00
|
|
|
|
|
|
|
`echo {{your_token}} | gh auth login --with-token`
|
|
|
|
|
|
|
|
- Check if you are logged in:
|
|
|
|
|
|
|
|
`gh auth status`
|
|
|
|
|
|
|
|
- Log out:
|
|
|
|
|
|
|
|
`gh auth logout`
|
|
|
|
|
2021-05-14 01:42:15 +01:00
|
|
|
- Log in with a specific GitHub Enterprise Server:
|
2020-10-26 10:14:22 +00:00
|
|
|
|
|
|
|
`gh auth login --hostname {{github.example.com}}`
|
2021-02-24 13:11:22 +00: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:
|
|
|
|
|
|
|
|
`gh auth refresh --scopes {{write:org,read:public_key}}`
|