gh auth login Sign in the GitHub CLI to your account

Logs the gh command-line tool in to GitHub, usually through your browser, and stores a token so later gh commands and git over https can act as you.

Synopsis

gh auth login [FLAGS]
gh auth status
gh auth logout

Common options

Option or formWhat it does
-h, --hostname HOSTSign in to a specific host, such as a GitHub Enterprise server
-w, --webOpen a browser to finish signing in
-p, --git-protocol https|sshWhich protocol git should use for your repositories
-s, --scopes SCOPESAsk for extra permissions on the token
--with-tokenRead a token from standard input instead of using the browser

Examples

Sign in interactively
gh auth login
Sign in using the browser straight away
gh auth login --web --git-protocol https
Check who you are signed in as
gh auth status
github.com
  ✓ Logged in to github.com account octocat
Sign in with a token from a file, for scripts
gh auth login --with-token < token.txt
Let git use gh for credentials
gh auth setup-git

Notes

See also

Last reviewed 2026-10-09.