Using your SSH Public Key for Verified GitHub Commits
↳ 📅 8/25/2022 ✍ guide, software, programming
Here's how to use our SSH Public Key for Verified GitHub Commits. Depending on the company you work for, this might be a required task as of 2022. Don't fret -- sing your SSH public keys to gain that green "Verified" badge on GitHub is very much possible and easy. Here's how to do it:
Make sure you're using latest git (>= 2.34.0):
(For Mac)
which git
by default on macOS will be/usr/bin/git
from Xcode. We don't want to use this version.(For Mac) Install the latest git via Brew and then run
brew unlink git && brew link git
which git
should reveal now/user/local/bin/git
Set Git to use SSH for keys:
Run
git config --global gpg.format ssh
Be warned that if you need proper GPG too, this isn't the guide for you.
Set your signing key:
Check for your existing SSH keys
(Situational) If keys are too old or short, check this StackOverflow issue.
pbcopy < ~/.ssh/id_rsa.pub
or whatever your key is called. Use ed25519 if you prefer.Double check it's your public key. 👀
Set global configs:
git config --global user.signingkey 'PASTE-YOUR-PUBKEY-HERE'
Go to GitHub Settings > Keys
Make sure you add your
id_rsa.pub
(or equivalent) as a Signing Key, not the Authentication Key that you probably already use it for.Save, then try out a test commit to see your verified badge.
Commit with the newly needed flags: `git commit -S -s -m "message-here"
-S
cryptographically signs-s
adds "Signed-off-by"
hope it helps.
- bryan