Skip to content

Instantly share code, notes, and snippets.

@cppshane
Created May 10, 2022 22:08
Show Gist options
  • Save cppshane/5ac71a7172d55fe36d9f801474f01c03 to your computer and use it in GitHub Desktop.
Save cppshane/5ac71a7172d55fe36d9f801474f01c03 to your computer and use it in GitHub Desktop.
Import/Export GPG Keys
# Get GPG keys
#
# Sample Output:
# sec rsa3072 2021-11-12 [SC] [expires: 2023-11-12]
# 12345ABCDE
# uid [ultimate] Shane Duffy <[email protected]>
# ssb rsa3072 2021-11-12 [E] [expires: 2023-11-12]
gpg --list-secret-keys [email protected]
# Export GPG key to file
gpg --export-secret-keys 12345ABCDE > private-gpg.key
# Import GPG key from file
gpg --import private-gpg.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment