Supply chainGitHub
Signed commits: GPG, SSH and what the Verified badge proves
Git lets you set the author and the committer of a commit yourself. A GPG, SSH or S/MIME signature lets GitHub mark the commit Verified. GitHub's documentation also states the cases that the mark does not cover.

What a signature adds
GitHub's documentation states the problem: Git lets anyone set the author of a change and the identity of the committer. Other people therefore have a hard time being confident that a commit is yours. You sign commits and tags locally. For GPG and SSH, GitHub checks the signature cryptographically against a public key you added to your account and, when it verifies, marks the commit Verified.
Three signature formats
- GPG. Git's default format. A GPG key can expire or be revoked, and the signature can carry that information. Generating the key takes more steps than SSH.
- SSH. GitHub's documentation calls it the simplest to generate. You can upload the key you already use for authentication a second time as a signing key. It needs Git 2.34 or later.
- S/MIME. Signs with an X.509 key that your organization issues. GitHub validates it against a trusted root certificate, so nobody uploads a public key. It needs Git 2.19 or later.
Sigstore's gitsign is a fourth route: keyless signing with your own OIDC identity. Its README states that GitHub does not recognize gitsign signatures as verified at the moment.
SSH signing in four commands
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
gh ssh-key add ~/.ssh/id_ed25519.pub --type signinggpg.format defaults to openpgp, and the other values are x509 and ssh. commit.gpgsign signs every commit, so nobody has to remember git commit -S. Set tag.gpgsign the same way for tags. The last command registers the public key on your GitHub account as a signing key.
To check SSH signatures on your own machine, Git needs a file of public keys you are willing to trust. The path is yours to choose:
git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
git log --show-signature -1Each line of that file holds one or more principals, such as email addresses, followed by a public key. Git's documentation explains that SSH has no concept of trust levels, so the file decides which signatures are trusted. Without it, git verify-commit exits with an error that says gpg.ssh.allowedSignersFile needs to be configured.
The Verified badge and vigilant mode
By default GitHub shows three states:
- Verified: the commit is signed and the signature was verified.
- Unverified: the commit carries a signature that could not be verified.
- No status: the commit is unsigned.
Vigilant mode changes the third state for your account: with "Flag unsigned commits as unverified" selected under SSH and GPG keys, an unsigned commit that has you as committer or author shows as Unverified. Turn it on only when you sign everything and commit with an email address verified on your account.
When GitHub verifies a signature at push time, it stores a verification record with the commit. The record cannot be edited, and it persists even if the signing key is later rotated, revoked or expired.
What the badge does not cover
GitHub's documentation names these limits:
- A different author. When a signed commit has an author who is not the committer and who has vigilant mode on, the signature does not guarantee the consent of the author. The commit is only Partially verified.
- A key revoked later. GitHub does not re-verify previously signed commits or adjust their status when the state of the key changes.
- Sign-off. Signing a commit differs from signing off on a commit.
- Commits made on GitHub. GitHub uses GPG to sign commits you make in the web interface, and they have a Verified status. The signature is GitHub's own, and its public key is at
https://github.com/web-flow.gpg.
A rule that requires signatures
The "Require signed commits" rule exists in rulesets and in classic branch protection. With it, contributors and bots can only push commits that are signed and verified. A collaborator who pushes an unsigned commit has to rebase it with a signature and force push.
Check automation before you enable it, because the rule applies to bots as well. GitHub's documentation sets two conditions for signature verification on bots: the request is authenticated as the GitHub App or bot, and it carries no custom author, committer or signature information. Dependabot signs its own commits by default.
Merge methods and signatures
- Squash and merge. GitHub signs the final squash commit. The rule still checks the commits on the head branch, so unsigned commits in a pull request can block a squash merge.
- Rebase and merge. GitHub creates modified commits from the originals and has no access to the committer's private signing keys. The commits are added to the base branch with no commit signature verification. The documented workaround is to rebase and merge locally, then push to the base branch.
Where to start
- Have every developer set up SSH signing and register the key as a signing key.
- Ask each person to enable vigilant mode once their commits show as Verified.
- List the bots and scripts that push commits, and give each a way to sign.
- Add the rule to one repository first, then widen the target.
Sources
- About commit signature verification, GitHub Docs
- Telling Git about your signing key, GitHub Docs
- Displaying verification statuses for all of your commits, GitHub Docs
- Available rules for rulesets, GitHub Docs
- About merge methods on GitHub, GitHub Docs
- git-config documentation
- sigstore/gitsign
- Dependabot security updates, GitHub Docs
Want a second pair of eyes on yours? We do this work for a living.
More guides

GitHub rulesets: protect branches and tags
Supply chain · 4 min read
Targets, bypass lists, layering and a JSON ruleset you can import to protect main.

Static analysis in CI: CodeQL, Semgrep and less noise
Supply chain · 4 min read
CodeQL and Semgrep in CI, with five documented ways to keep the findings few enough to act on.

Scan container images with Trivy in CI
Supply chain · 4 min read
The flags, the ignore file, the pinned action and the limits of scanning an image with Trivy.