gh auth
Sign in to GitHub from the terminal and check who you are signed in as
What it does
Before you work with GitHub through gh, sign in: gh auth login asks a couple of questions (GitHub.com or a company server, HTTPS or SSH) and opens the browser, where you confirm with a code. The token goes into the system password store, and after that gh asks nothing.
gh auth status shows which account you are signed in to and what scopes the token has. If a command lacks permissions, gh auth refresh -s <scope> adds them, and gh auth logout signs you out.
Syntax
gh auth login
gh auth status
gh auth logoutExamples
Sign in to your GitHub account from the terminal
gh auth logingh— GitHub CLIauth— sign-in and tokenslogin— sign in; asks how and opens the browser
Check which account gh is signed in as
gh auth statusauth— sign-in and tokensstatus— the account, the host and the token's scopes
Related commands
- gh repo clone — Clone a GitHub repository by its short name
- gh secret set — Add a secret for GitHub Actions
- git config — Set up git: the author name and email, the editor and other settings