Skip to content
DevOps

SSH Keys and Commit Signing: Ed25519, ssh-agent, FIDO2 and Vigilant Mode

AIDToolStack EditorialUpdated November 7, 20268 min read
securitysshgpgyubikeydevops
Share:Twitter

Git trusts whatever you type into user.name and user.email. Anyone can make a commit that claims to be from you, push it to a repo they control, and GitHub will show your avatar next to it. Meanwhile the SSH key that does prove who's pushing has often sat unencrypted in ~/.ssh since a laptop three jobs ago.

Both problems take about fifteen minutes to fix, and in 2026 the same Ed25519 key can handle authentication and commit signing. Here's the setup I'd give a new teammate, with every command taken from GitHub Docs or the OpenSSH manuals.

Generate an Ed25519 key with a passphrase

ssh-keygen -t ed25519 -C "[email protected]"

That's the command GitHub Docs gives. On current OpenSSH you could drop -t entirely: OpenSSH 9.5 (October 2023) made ssh-keygen "generate Ed25519 keys by default." GitHub's fallback for systems without Ed25519 is ssh-keygen -t rsa -b 4096, which you should only need on very old servers.

Two things worth knowing from the ssh-keygen manual:

  • Keys are written in OpenSSH's own format, which protects a passphrase-encrypted key better than the old PEM format. -a sets the number of bcrypt KDF rounds used on the passphrase (default 32). The manual says higher numbers mean slower passphrase checks and more resistance to brute-force cracking "should the keys be stolen."
  • If you already have a key and it has no passphrase, add one without regenerating: ssh-keygen -p -f ~/.ssh/id_ed25519.

Set the passphrase. A private key file with no passphrase is a bearer credential to every server and repo it's registered on; anyone who copies that one file from a backup, a stolen laptop or a compromised dependency's postinstall script has it.

As of November 2026, the current OpenSSH release is 10.6p2 (5 November 2026). Since 10.0, DSA support is gone and the hybrid post-quantum key exchange mlkem768x25519-sha256 is the default for key agreement, so keeping your client current also keeps your transport modern. GitHub no longer accepts DSA keys either.

Our SSH key generator produces Ed25519 and RSA pairs in the browser with the Web Crypto API, which is handy for test fixtures and throwaway CI keys. For a key that guards real access, I'd still run ssh-keygen on the machine that will hold it, so the private key never exists anywhere else.

Let ssh-agent hold the passphrase

Typing the passphrase on every git fetch gets old fast, which is why people skip it. ssh-agent holds the decrypted key in memory instead. On macOS, GitHub's recommended ~/.ssh/config:

Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

then once:

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

GitHub notes this needs Apple's bundled ssh-add, not a Homebrew one. On Linux, eval "$(ssh-agent -s)" and ssh-add ~/.ssh/id_ed25519, or let your desktop's keyring do it.

A few agent options from the ssh-add and ssh_config manuals that are worth turning on:

  • ssh-add -t 8h sets a lifetime, so the key drops out of the agent at the end of the day.
  • ssh-add -c asks for confirmation each time the key is used. Annoying for signing every commit, useful for a production-access key.
  • IdentitiesOnly yes under a Host block makes ssh offer only the key you configured, not every key in the agent.
  • ForwardAgent: the manual says agent forwarding "should be enabled with caution," because anyone who can get around file permissions on the remote host can use your agent through the forwarded connection. Prefer ProxyJump for hopping through a bastion; it doesn't hand your agent to the middle box.

Hardware-backed keys (FIDO2)

OpenSSH 8.2 (February 2020) added FIDO/U2F authenticator support via two key types, ed25519-sk and ecdsa-sk. Per those release notes, the device's private key "cannot be exported from the token hardware"; the file in ~/.ssh holds only a key handle, and the token must be attached whenever the key is used.

ssh-keygen -t ed25519-sk -C "[email protected]"
# if the token doesn't support Ed25519, GitHub suggests:
ssh-keygen -t ecdsa-sk -C "[email protected]"

The -O options in the ssh-keygen manual let you tune it:

OptionEffect
-O residentStore the key handle on the authenticator, so you can load it on a new machine with ssh-add -K
-O verify-requiredRequire user verification (PIN or biometric) for every signature, not just a touch
-O application=ssh:workOverride the default ssh: application string
-O no-touch-requiredSkip the touch requirement (defeats much of the point; avoid)

GitHub's docs say the device must stay connected while you authenticate. My suggestion: a hardware key for anything with production or admin access, and an ordinary passphrase-protected Ed25519 key for day-to-day git if touching a token on every push would drive you to disable it. If hardware keys interest you for web logins too, our password security post covers passkeys.

Sign commits with the SSH key you already have

GitHub supports three signature types: GPG, SSH and S/MIME. Its commit signature docs say "SSH signatures are the simplest to generate," and you can reuse your authentication key. It requires Git 2.34 or later.

Diagram: one Ed25519 key on your machine is used for git push over SSH, matched against an authentication key on GitHub, and for git commit -S, matched against the same public key uploaded as a signing key, which produces the Verified badge
Diagram: one Ed25519 key on your machine is used for git push over SSH, matched against an authentication key on GitHub, and for git commit -S, matched against the same public key uploaded as a signing key, which produces the Verified badge

The setup, from Telling Git about your signing key:

git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
git config --global tag.gpgSign true

Then upload the same public key a second time on GitHub, choosing Signing Key as the key type. GitHub's adding a key page notes a key used for both jobs has to be added twice. With the CLI:

gh ssh-key add ~/.ssh/id_ed25519.pub --type signing

Make sure the email in your commits is a verified address on your account, or GitHub can't tie the signature to you.

To verify SSH signatures locally, Git needs to know which keys to trust. The git-config docs describe gpg.ssh.allowedSignersFile as a file of principals followed by a public key:

echo "[email protected] $(cat ~/.ssh/id_ed25519.pub)" >> ~/.config/git/allowed_signers
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers
git log --show-signature -1

The same docs note that since OpenSSH 8.8 the file can carry valid-after and valid-before options, which is how you express "this key was valid until we rotated it."

SSH signing or GPG?

GitHub itself frames the trade-off: GPG takes more work to set up, but "GPG has features that SSH does not," namely key expiry and revocation that show up in the signature status.

SSH signingGPG signing
SetupReuse your existing key; four git config linesGenerate a key with gpg --full-generate-key, export, upload
Git version2.34+Any
Expiry and revocationNot in the key; valid-after/valid-before in allowed_signers for local checksBuilt into the key, reflected in GitHub's status
Passphrase cachingssh-agent, Keychain on macOSgpg-agent; GitHub notes it doesn't integrate with Keychain like ssh-agent, so many people use GPG Suite or Gpg4win

For an individual or a team on GitHub, I'd pick SSH signing. The setup friction of GPG is the main reason people never sign anything, and one key to protect beats two. Pick GPG if you already have an OpenPGP identity with subkeys, need signatures that other tooling verifies through the web of trust, or want revocation visible on GitHub.

Also note what verification on GitHub means after a rotation. Per GitHub, "once a commit signature is verified, it remains verified within its repository's network," even if you later remove or rotate the key. So rotating a key doesn't turn your history red.

Turn on vigilant mode, but only after you sign everything

Signing your own commits doesn't stop someone else from pushing unsigned commits under your email. Vigilant mode closes that gap: with it on, every commit attributed to you gets a status, and unsigned ones are marked Unverified. There's also Partially verified, when a signed commit lists a co-author who has vigilant mode on but isn't the committer, because the signature doesn't prove that co-author agreed.

Enable it under Settings, then SSH and GPG keys, then "Flag unsigned commits as unverified." GitHub's warning is the important bit: "You should only enable vigilant mode if you sign all of your commits and tags." Set commit.gpgsign true on every machine you commit from first, including that old desktop, or your own pushes start showing up as Unverified.

The fifteen-minute checklist

  1. ssh-keygen -t ed25519, with a passphrase. Add one to old keys with ssh-keygen -p.
  2. Agent with a lifetime (ssh-add -t), IdentitiesOnly yes, no blanket ForwardAgent.
  3. Delete stale keys from GitHub and from ~/.ssh/authorized_keys on servers you manage.
  4. Hardware -sk key for production and admin access.
  5. gpg.format ssh, user.signingkey, commit.gpgsign true, tag.gpgSign true, then upload the key as a Signing Key.
  6. An allowed_signers file so git log --show-signature works locally.
  7. Vigilant mode, once every machine signs.

If your team is deciding between hosts, our GitHub vs GitLab comparison is a good next read, and the Git command generator helps when you can't remember the flag for something rarer.

AE

Written by AIDToolStack Editorial

Researched from official documentation, specifications and vendor pages, listed under Sources below. Last checked November 2026.

Sources

  1. docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
  2. www.openssh.org/txt/release-9.5
  3. man.openbsd.org/ssh-keygen
  4. www.openssh.org/releasenotes.html
  5. docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
  6. man.openbsd.org/ssh-add
  7. man.openbsd.org/ssh_config
  8. www.openssh.org/txt/release-8.2
  9. docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification
  10. docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key
  11. git-scm.com/docs/git-config
  12. docs.github.com/en/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits
  13. git-scm.com/docs/git-log
  14. docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key
  15. docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

Related Posts

Explore on AIDToolStack

Discover tools and servers featured in our directory.

MCP Servers

Trigger.dev Jobs MCP ServerManage Trigger.dev background jobs from your AI coding assistant. Monitor job runs, trigger tasks manually, inspect execution logs, manage schedules, and debug failed runs. The server provides operational visibility into your background job infrastructure — see which tasks are running, queued, or failed, and take action. Your AI can help diagnose job failures from execution logs, retry failed tasks, and optimize concurrency configurations for better throughput.Tailscale Network MCP ServerManage your Tailscale mesh VPN network from your AI coding assistant. View connected devices, manage ACLs, configure exit nodes, check device status, and manage DNS settings. The server provides visibility into your Tailscale network — see which machines are online, troubleshoot connectivity issues, manage network access policies, and configure routes. Useful for developers managing distributed infrastructure where Tailscale provides secure networking between services.Portainer Docker MCP ServerManage Docker environments through Portainer's API from your AI coding assistant. Control containers, images, networks, and volumes across multiple Docker hosts and Kubernetes clusters. The server provides tools for container lifecycle management, image pulling and building, stack deployment, and resource monitoring. Portainer's multi-environment management makes this server particularly valuable for teams managing containers across development, staging, and production environments.

Reviews

Sign in to leave a review.

No reviews yet. Be the first!

Comments

Sign in to leave a comment.

No comments yet. Be the first!

Sponsor Our Newsletter

Reach thousands of developers who are actively evaluating AI tools, MCP servers, and dev infrastructure. Our weekly newsletter goes to engaged technical decision-makers.

Growing subscriber baseHigh open rates

All sponsored content is clearly labeled per our editorial policy.