gh-ssh-key

Manage SSH keys for GitHub authentication

TLDR

List SSH keys
$ gh ssh-key list
Add an SSH key
$ gh ssh-key add [key.pub]
Add with title
$ gh ssh-key add [key.pub] -t "[title]"
Delete an SSH key
$ gh ssh-key delete [key_id]

SYNOPSIS

gh ssh-key command [options]

DESCRIPTION

gh ssh-key manages SSH public keys associated with your GitHub account for secure Git authentication. SSH keys provide an alternative to HTTPS authentication, enabling passwordless git operations.The command supports adding new SSH keys from public key files, typically generated with ssh-keygen. Keys can be labeled with titles for identification when managing multiple keys across different machines. Deletion removes keys from your GitHub account, immediately revoking access.

PARAMETERS

-t, --title title

Key title.

SUBCOMMANDS

list

List SSH keys.
add
Add an SSH key.
delete
Delete an SSH key.

INSTALL

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

SEE ALSO

gh(1), gh-gpg-key(1)

RESOURCES

Documentation · Source code