When you are setting up a coding environment on a new machine or has just found that your GPG keys were missing for some reasons (it really happened on my Windows PC), you may need to transfer your GPG secret keys elsewhere.
It takes advantage of gpg --export-secret-key
, gpg --import
and pipe syntax. This method is an excerpt of a StackOverflow answer.
If you're on the machine that already has the key:
gpg --export-secret-key SOMEKEYID | ssh othermachine gpg --import