Skip to content

Instantly share code, notes, and snippets.

@cppshane
Last active February 5, 2025 16:32
Show Gist options
  • Save cppshane/a26dde07705221f6657faa20a0285a29 to your computer and use it in GitHub Desktop.
Save cppshane/a26dde07705221f6657faa20a0285a29 to your computer and use it in GitHub Desktop.
GPG/SSH Setup
# Generate GPG key
# Sample Output:
# /home/shane/.gnupg/pubring.kbx
# ------------------------------
# sec rsa3072/12345ABCDE 2021-11-12 [SC] [expires: 2023-11-12]
# 123456789
# uid [ultimate] Shane Duffy <[email protected]>
# ssb rsa3072/12345ZZZZZ 2021-11-12 [E] [expires: 2023-11-12]
gpg --gen-key
gpg --list-secret-keys --keyid-format LONG
# Output key, add result to GitHub
gpg --armor --export 12345ABCDE
# Set as signing key
git config --global user.signingkey 12345ABCDE
git config --global commit.gpgsign true
## Generate SSH key
ssh-keygen -t rsa -b 4096 -C "[email protected]"
# Output key, add result to GitHub
cat ~/.ssh/id_rsa.pub
# Add to SSH Agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment