git verify-commit
Check the GPG signature of commits
The 'git verify-commit' command checks the cryptographic signature of commits made with git commit -S. It prints what GPG (or SSH) reports: who signed and whether the signature is good. It exits with an error for unsigned or badly signed commits, so it can guard deployments and merges.
Synopsis
git verify-commit [-v | --verbose] [--raw] <commit>...Examples
Verify the last commit
git verify-commit HEADShows the signature status.
See signatures in the log
git log --show-signature -3The same check for several commits.
Workflow Examples
git config --global user.signingkey <key-id>Pick your key
git commit -S -m "Release"Sign the commit
git verify-commit HEADCheck it
Troubleshooting
gpg: Can't check signature: No public key
Cause: You do not have the signer’s public key
Import it: gpg --recv-keys <key-id>
Tips & Pitfalls
Best Practices
- ✓Sign release commits and tags; verify them in CI.
Common Mistakes
- ✗Expecting a signature on commits made without -S or commit.gpgSign=true.
FAQ
Yes, since Git 2.34: git config gpg.format ssh.