Skip to content

Instantly share code, notes, and snippets.

@mauvehed
Created April 22, 2024 14:28
Show Gist options
  • Save mauvehed/60f8b4426fa9bab53d3eb0578138cc0b to your computer and use it in GitHub Desktop.
Save mauvehed/60f8b4426fa9bab53d3eb0578138cc0b to your computer and use it in GitHub Desktop.
GnuPG Command Line Usage

list private key and get ID(s)

gpg --list-secret-keys --keyid-format=long

export ascii armor public key

gpg --armor --export YOUR_KEY_ID

export encrypted private key

gpg --armor --export-secret-keys YOUR_KEY_ID > encrypted_private_key.asc

import encrypted private key

gpg --import encrypted_private_key.asc

add new email to private key

Run gpg --edit-key YOUR_KEY_ID

Run gpg> list to see user IDs

Run gpg> uid N to select the user ID you want as primary (replace N with the number)

Run gpg> primary

Enter your key's password when prompted

Run gpg> save to save changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment