How to backup GPG keys in a password-manager-friendly manner.
Export private keys:
gpg --export-secret-keys --export-options export-minimal > private-keyring.gpg
Encode it with base64:
base64 private-keyring.gpg > private-keyring.base64
Now private-keyring.base64
can be stored as a text filed in your password manager.
Copy the text from your password manager, then decode it:
base64 -d keyring.base64 > keyring.gpg
Import it back to the system:
mkdir -p .gnupg/private-keys-v1.d
gpg --homedir .gnupg --import keyring.gpg
Check keyring content with gpg -K
.
Source: https://www.saminiir.com/paper-storage-and-recovery-of-gpg-keys/.