gh-auth-login - Authenticate with a GitHub host

NAME  SYNOPSIS  DESCRIPTION  OPTIONS  EXAMPLE  SEE ALSO 

NAME

gh-auth-login - Authenticate with a GitHub host

SYNOPSIS

gh auth login [flags]

DESCRIPTION

Authenticate with a GitHub host.

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 gh auth status for its stored location.

Alternatively, use --with-token to pass in a token on standard input. The minimum required scopes for the token are: "repo", "read:org".

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 gh help environment for more info.

To use gh in GitHub Actions, add GH_TOKEN: ${{ github.token }} to "env".

OPTIONS

-p, --git-protocol <string>

The protocol to use for git operations: {ssh|https}

-h, --hostname <string>

The hostname of the GitHub instance to authenticate with

--insecure-storage

Save authentication credentials in plain text instead of credential store

-s, --scopes <strings>

Additional authentication scopes to request

-w, --web

Open a browser to authenticate

--with-token

Read token from standard input

EXAMPLE

# 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 a specific GitHub instance
$ gh auth login --hostname enterprise.internal

SEE ALSO

gh-auth(1)


Updated 2024-01-29 - jenkler.se | uex.se