gh auth login
Authenticate with a GitHub host
Synopsis
Authenticate with a GitHub host.
This interactive command initializes your authentication state either by helping you log into GitHub via browser-based OAuth or by accepting a Personal Access Token.
The interactivity can be avoided by specifying –with-token and passing a token on STDIN.
gh auth login [flags]
Examples
$ gh auth login
# => do an interactive setup
$ gh auth login --with-token < mytoken.txt
# => read token from mytoken.txt and authenticate against github.com
$ gh auth login --hostname enterprise.internal --with-token < mytoken.txt
# => read token from mytoken.txt and authenticate against a GitHub Enterprise Server instance
Options
-h, --hostname string The hostname of the GitHub instance to authenticate with
-w, --web Open a browser to authenticate
--with-token Read token from standard input
Options inherited from parent commands
--help Show help for command

