Skip to content

Instantly share code, notes, and snippets.

@okineadev
Forked from lysender/export-import-gpg-keys.md
Last active May 21, 2024 08:27
Show Gist options
  • Save okineadev/dcc92e5277c03cdc090ef4654ecf7efe to your computer and use it in GitHub Desktop.
Save okineadev/dcc92e5277c03cdc090ef4654ecf7efe to your computer and use it in GitHub Desktop.
Export and import GPG Keys

Export public key

gpg --export [email protected] > my_key.pub 

The file can then be shared to other people.

Export public key in armor ASCII format

gpg --armor --export YOUR_KEY_ID_HERE

This text can then be used on GitHub for example to verify commits.

Export secret key

gpg --output mygpgkey_sec.gpg --armor --export-secret-key ABCDFE01

Import public and secret keys on the other machine

gpg --import ~/mygpgkey_pub.gpg
gpg --allow-secret-key-import --import ~/mygpgkey_sec.gpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment