GPG: Share existing GPG key

less than 1 minute read

If you have an existing registered GPG key and GitHub account configured to use it so you can share it across multiple machines.

Export existing GPG key

First of all, you need to export the existing GPG key by using this command:

gpg --export-secret-key --armor > secretkey.asc

Then enter your key’s secret passphrase in prompt dialog.

This will export your key to secretkey.asc file in the current folder.

Import GPG key on the target machine

Note that you need to install GPG CLI on the target machine before importing GPG key.

Next just import key from a generated key file on target machine by the following command:

gpg --import secretkey.asc

You need to enter the secret passphrase again.


Now you can set up a target machine environment to use imported GPG key. Check how to do that here.