LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gh-gpg-key

Manage GPG keys on GitHub for commit signing

TLDR

List GPG keys on your GitHub account
$ gh gpg-key list
copy
Add a GPG key from a file
$ gh gpg-key add [key.pub]
copy
Add a GPG key from stdin
$ gpg --armor --export [key_id] | gh gpg-key add -
copy
Add a GPG key with a title
$ gh gpg-key add [key.pub] --title "[Work laptop]"
copy
Delete a GPG key by ID
$ gh gpg-key delete [key_id]
copy

SYNOPSIS

gh gpg-key subcommand [options]

DESCRIPTION

gh gpg-key manages GPG keys associated with your GitHub account. GitHub uses these keys to verify signed commits and tags, displaying a "Verified" badge in the web UI when signatures match a registered key.Keys must be exported in ASCII-armored format (e.g. via gpg --armor --export). To enable verification, the key's email must also match a verified email on the account, and commits must be signed locally (e.g. via git config commit.gpgsign true).

PARAMETERS

-t, --title string

Title of the new key (used by add).
--yes
Skip the interactive confirmation prompt (used by delete).

SUBCOMMANDS

list

List the GPG keys associated with the authenticated user.
add [key-file]
Add a GPG public key to your GitHub account. Reads from stdin if - is passed instead of a file.
delete key-id
Remove a GPG key from your GitHub account by its numeric ID.

CAVEATS

Requires authentication via gh auth login. The acting user must have admin:gpg_key scope on their token. Keys uploaded to GitHub cannot be used to decrypt anything — GitHub only stores public keys for signature verification.

SEE ALSO

gh(1), gh-ssh-key(1), gpg(1), git-commit(1)

Copied to clipboard
Kai