Skip to content

Instantly share code, notes, and snippets.

@lucaspar
Last active October 4, 2019 20:26
Show Gist options
  • Save lucaspar/10869ffca6f4fca31b3beb65da9836ff to your computer and use it in GitHub Desktop.
Save lucaspar/10869ffca6f4fca31b3beb65da9836ff to your computer and use it in GitHub Desktop.
[ BKP ] Backing up GPG keys

Backing up GPG keys 🔐

Based on here

Export:

gpg --armor --export > pub.asc
gpg --armor --export-secret-keys > priv.asc
gpg --armor --export-ownertrust > trust.asc
cp ~/.gnupg/*.conf .
tar cJf gpg-backup.txz pub.asc priv.asc trust.asc *.conf

Import:

tar xJf gpg-backup.txz
gpg --import < priv.asc
gpg --import < pub.asc
gpg --import-ownertrust < trust.asc
gpg   # to create ~/.gnupg dir
cp *.conf ~/.gnupg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment