← 返回命令列表

Linux command

gh-gpg-key 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

List GPG keys

gh gpg-key list

Add a GPG key

gh gpg-key add [key.pub]

Add a GPG key

gpg --armor --export [key_id] | gh gpg-key add -

Add a GPG key with a title

gh gpg-key add [key.pub] --title "[Work laptop]"

Delete a GPG key

gh gpg-key delete [key_id]

说明

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).

参数

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

FAQ

What is the gh-gpg-key command used for?

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).

How do I run a basic gh-gpg-key example?

Run `gh gpg-key list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --title _string_ do in gh-gpg-key?

Title of the new key (used by add).