Automatically sign all your Git commits and get the β Verified badge on GitHub.
- Git installed
- A GitHub account
ssh-keygen -t ed25519 -C "[email protected]"- Press Enter to accept the default path (
~/.ssh/id_ed25519) - Optionally, set a passphrase for extra security or press Enter to skip
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519- Copy your public key:
cat ~/.ssh/id_ed25519.pub- On GitHub: Settings β SSH and GPG keys β New SSH key
| Field | Value |
|---|---|
| Title | e.g. My Laptop |
| Key type | Authentication Key |
| Key | Paste your public key |
- Go to GitHub: Settings β SSH and GPG keys β New SSH key
| Field | Value |
|---|---|
| Title | e.g. My Laptop (Signing) |
| Key type | Signing Key |
| Key | Paste the same public key |
β You can use the same key for both authentication and signing.
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign trueGo to GitHub: Settings β SSH and GPG keys β Vigilant mode
β Check "Flag unsigned commits as unverified"
This ensures all commits in your repositories show a verification badge.
git commit -m "test: signed commit"
git log --show-signature -1Expected output:
Good "git" signature for [email protected] with ED25519 key SHA256:...
And youβll see a β Verified badge in GitHub commit history.
| Step | Action |
|---|---|
| 1 | Generate SSH key with ssh-keygen |
| 2 | Add key to SSH agent |
| 3 | Add to GitHub as Authentication Key |
| 4 | Add to GitHub as Signing Key |
| 5 | Configure Git to auto-sign commits |
| 6 | Enable Vigilant Mode on GitHub |
| 7 | Test with git log --show-signature |
- Multiple machines: Repeat Steps 1β5 or securely copy your
~/.ssh/id_ed25519key. - Check Git config anytime:
git config --global --list | grep -E "gpg|sign|signing"- View existing SSH keys before generating new ones:
ls -al ~/.ssh