.nh .TH "GH-AUTH-LOGIN" "1" "Mar 2024" "" "GitHub CLI manual" .SH NAME .PP gh-auth-login - Log in to a GitHub account .SH SYNOPSIS .PP \fBgh auth login [flags]\fR .SH DESCRIPTION .PP Authenticate with a GitHub host. .PP The default authentication mode is a web-based browser flow. After completion, an authentication token will be stored securely in the system credential store. If a credential store is not found or there is an issue using it gh will fallback to writing the token to a plain text file. See \fBgh auth status\fR for its stored location. .PP Alternatively, use \fB--with-token\fR to pass in a token on standard input. The minimum required scopes for the token are: \fBrepo\fR, \fBread:org\fR, and \fBgist\fR\&. .PP Alternatively, gh will use the authentication token found in environment variables. This method is most suitable for "headless" use of gh such as in automation. See \fBgh help environment\fR for more info. .PP To use gh in GitHub Actions, add \fBGH_TOKEN: ${{ github.token }}\fR to \fBenv\fR\&. .PP The git protocol to use for git operations on this host can be set with \fB--git-protocol\fR, or during the interactive prompting. Although login is for a single account on a host, setting the git protocol will take effect for all users on the host. .SH OPTIONS .TP \fB-p\fR, \fB--git-protocol\fR \fB\fR The protocol to use for git operations on this host: {ssh|https} .TP \fB-h\fR, \fB--hostname\fR \fB\fR The hostname of the GitHub instance to authenticate with .TP \fB--insecure-storage\fR Save authentication credentials in plain text instead of credential store .TP \fB-s\fR, \fB--scopes\fR \fB\fR Additional authentication scopes to request .TP \fB-w\fR, \fB--web\fR Open a browser to authenticate .TP \fB--with-token\fR Read token from standard input .SH EXAMPLE .EX # Start interactive setup $ gh auth login # Authenticate against github.com by reading the token from a file $ gh auth login --with-token < mytoken.txt # Authenticate with specific host $ gh auth login --hostname enterprise.internal .EE .SH SEE ALSO .PP \fBgh-auth(1)\fR