Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deybhayden/7f8f9c377475cf2c1f9e1635e86b8341 to your computer and use it in GitHub Desktop.
Save deybhayden/7f8f9c377475cf2c1f9e1635e86b8341 to your computer and use it in GitHub Desktop.
Instructions for exporting/importing (backup/restore) GPG keys

Method 2

This only really works if you don't mind losing any other keys (than your own).

Export public and secret key and ownertrust

gpg -a --export chris@seagul.co.uk > chrisroos-public-gpg.key
gpg -a --export-secret-keys chris@seagul.co.uk > chrisroos-secret-gpg.key
gpg --export-ownertrust > chrisroos-ownertrust-gpg.txt

Import secret key (which contains the public key) and ownertrust

gpg --import chrisroos-secret-gpg.key
gpg --import-ownertrust chrisroos-ownertrust-gpg.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment