| name | gpg-export-public-key |
| description | Export a GPG public key in ASCII-armored form, ready to share, paste into GitHub, or upload to a keyserver. Use when the user wants to publish their public key, share it with a collaborator, or register it for signed commits. Selects the key by email, key ID, or fingerprint. |
Export a GPG Public Key
When to use
The user wants to share their public key — to register on GitHub for verified commits, send to a correspondent for encrypted email, publish on a keyserver, or paste into a website's "PGP key" field.
Identify the key
If the user didn't specify which key, list available secret keys (only keys whose private half is on this machine can be meaningfully "their" public key to share):
gpg --list-secret-keys --keyid-format=long
Pick by email, long key ID, or full fingerprint.
Export
ASCII-armored (the universal default for sharing):
gpg --armor --export <email-or-keyid>
Write to file:
gpg --armor --export <email-or-keyid> > <name>-public.asc
Binary (for tooling that wants .gpg):
gpg --export <email-or-keyid> > <name>-public.gpg
Common destinations
Verify what you exported
Show the fingerprint so the user can confirm it matches what they intended:
gpg --show-keys <name>-public.asc
Notes
- The exported file contains only the public half — it's safe to share. Never export with
--export-secret-keys unless the user is migrating their private key to another machine.
- To export the private key (rare, for migration only), use the
gpg-export-private-key workflow — out of scope for this skill, and require explicit user confirmation before running.