Created
December 6, 2018 11:17
-
-
Save lovejavaee/3c891cc9e6b7381b27e7dc48ed5b1839 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GPG: Extract private key and import on different machine | |
After extending the expiry date of a GPG key you might have to copy your key to another machine to use the same key there. Here is how: | |
Identify your private key by running gpg --list-secret-keys. You need the ID of your private key (second column) | |
Run this command to export your key: gpg --export-secret-keys $ID > my-private-key.asc | |
Copy the key to the other machine (scp is your friend) | |
To import the key, run gpg --import my-private-key.asc | |
If the key already existed on the second machine, the import will fail saying 'Key already known'. You will have to delete both the private and public key first (gpg --delete-keys and gpg --delete-secret-keys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment