LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gh-auth

manage GitHub CLI authentication and credentials

TLDR

Login to GitHub
$ gh auth login
copy
Login with specific host
$ gh auth login --hostname [github.example.com]
copy
Check authentication status
$ gh auth status
copy
Logout from GitHub
$ gh auth logout
copy
Refresh authentication
$ gh auth refresh
copy

SYNOPSIS

gh auth command [options]

DESCRIPTION

gh auth manages authentication for the GitHub CLI. It handles OAuth device flow, personal access tokens, and SSH key authentication across multiple GitHub hosts.The command stores credentials securely in the system keychain when available, falling back to encrypted file storage. It supports github.com and GitHub Enterprise Server instances simultaneously.gh auth provides the foundation for all authenticated gh operations.

PARAMETERS

login

Authenticate with a GitHub host.
logout
Log out of a GitHub host.
status
View authentication status.
refresh
Refresh stored credentials.
token
Print authentication token.
--hostname HOST
GitHub hostname (for Enterprise).
--web
Open browser for authentication.
--with-token
Read token from stdin.
--help
Display help information.

CONFIGURATION

~/.config/gh/hosts.yml

Stores authentication tokens and host-specific settings for each GitHub instance.

INSTALL

sudo apt install gh
copy
sudo dnf install gh
copy
sudo pacman -S github-cli
copy
sudo apk add github-cli
copy
sudo zypper install gh
copy
brew install gh
copy
nix profile install nixpkgs#gh
copy

CAVEATS

Token scopes affect available commands. Enterprise instances may require SSO authentication. Credentials stored in keychain or config file.

HISTORY

gh auth is part of the GitHub CLI, providing secure authentication workflows designed for both interactive and scripted use cases.

SEE ALSO

gh(1), gh-config(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid