gh-auth - Man Page
Authenticate gh and git with GitHub
Examples (TL;DR)
- 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:
gh auth login --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 --scopes repo,admin:repo_hook,admin:org,admin:public_key,admin:org_hook,...
Synopsis
gh auth <command> [flags]
Available Commands
- gh-auth-login(1)
Log in to a GitHub account
- gh-auth-logout(1)
Log out of a GitHub account
- gh-auth-refresh(1)
Refresh stored authentication credentials
- gh-auth-setup-git(1)
Setup git with GitHub CLI
- gh-auth-status(1)
View all accounts and authentication status
- gh-auth-switch(1)
Switch active GitHub account
- gh-auth-token(1)
Print the authentication token gh uses for a hostname and account
See Also
Referenced By
gh(1), gh-auth-login(1), gh-auth-logout(1), gh-auth-refresh(1), gh-auth-setup-git(1), gh-auth-status(1), gh-auth-switch(1), gh-auth-token(1).
Jul 2024 GitHub CLI manual