GPG is useful especially for signing commits on GitHub. It is a good idea to pre-emptively make backups of your GPG credentials, as extracting them from an unbootable system drive is not a straightforward process.
Backing up GPG
These steps should work on most, if not all, Linux distributions.
First, export your credentials
gpg --export --export-options backup --output public.gpg
gpg --export-secret-keys --export-options backup --output private.gpg
gpg --export-ownertrust >> trust.gpg
Afterwards, copy these 3 files public.gpg private.gpg trust.gpg to somewhere safe (like an external drive or NAS).
You can import them on a new machine by running the following
gpg --import public.gpg
gpg --import private.gpg gpg --import-ownertrust trust.gpg
Tip: For GitHub users, if you need to sign commits using your existing GPG key on your new machine, here is the official guide.
...more