gh-auth
Authenticate with GitHub
TLDR
Log in with interactive prompt
Log in with a token from stdin (created in
Check if you are logged in
Log out
Log in with a specific GitHub Enterprise Server
Refresh the session to ensure authentication credentials have the correct minimum scopes (removes additional scopes requested previously)
Expand the permission scopes
SYNOPSIS
gh auth <command> [flags]
PARAMETERS
login
Authenticate with GitHub.
logout
Log out of GitHub.
status
View your current authentication status.
refresh
Refresh stored authentication credentials.
token
Manually set an authentication token.
whoami
Display the currently authenticated user.
DESCRIPTION
The `gh auth` command is part of the GitHub CLI (`gh`) and manages authentication for interacting with GitHub repositories from the command line. It handles the login process, enabling secure access to your GitHub account and repositories without requiring you to manually enter credentials repeatedly. The command uses OAuth to obtain access tokens, which are stored securely on your system. The command supports different authentication flows, including browser-based and password-based authentication. Once authenticated, `gh` can perform various GitHub operations, such as cloning repositories, creating pull requests, and managing issues, all directly from your terminal. The command simplifies interacting with GitHub and automation processes from the CLI environment, removing the need to use public keys or provide passwords in scripts. It aims to streamline the workflow of developers using GitHub.
CAVEATS
The authentication token is stored securely on your system, but its security depends on the overall security of your system. Ensure your system is protected against malware and unauthorized access.
AUTHENTICATION FLOWS
Browser-based Authentication:
Opens a web browser to authenticate with your GitHub account.
PAT (Personal Access Token) Authentication:
Allows you to manually enter a personal access token for authentication.
Password Authentication:
Direct authentication using your GitHub account username and password. This is less secure and is generally discouraged.
CONFIGURATION
The command saves the configuration on a standard location. The location depends of the operative system.