Skip to content

Instantly share code, notes, and snippets.

@patheticGeek
Created May 21, 2021 04:44
Show Gist options
  • Save patheticGeek/d580dac462f591930accd4352e20a1de to your computer and use it in GitHub Desktop.
Save patheticGeek/d580dac462f591930accd4352e20a1de to your computer and use it in GitHub Desktop.
How to setup git with GPG keys for that green verified mark
  1. Generate your key
gpg --full-generate-key
  1. Export the key, copy the output and add it to github's gpg keys section
gpg --armor --export <key-id>
  1. Turn on commit signature and set default signing key
git config --global commit.gpgsign true
git config --global user.signingKey <key-id>

To get key id, run:

gpg --list-secret-keys --keyid-format LONG

In the output:

/home/user/.gnupg/pubring.kbx
---------------------------------
sec   rsa4096/XXXXXXXXXXXXXXXX 2021-05-21 [SC]
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
uid                 [ultimate] Jane doe <janedoe@email.com>
ssb   rsa4096/<key-id-here> 2021-05-21 [E]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment