Validates signed commits.
Verify the GPG or SSH signature attached to a commit. The cryptographic answer to 'did this person actually author this commit?'
Git stores a detached signature in the commit object header; verify-commit re-runs the verifier (gpg or ssh-keygen) against your local trust database.
git verify-commit [-v | --verbose] [--raw] <commit>...
Exits 0 if every signature is good, non-zero otherwise. Output goes to
stderr (the human-readable verifier message); stdout is reserved for
--verbose commit content. Honors gpg.program / gpg.ssh.allowedSignersFile.| Flag | What it does |
|---|---|
-v / --verbose | Print the commit content in addition to the signature status. |
--raw | Emit the verifier's raw machine-readable status lines (GOODSIG, BADSIG, ERRSIG, EXPKEYSIG, REVKEYSIG, TRUST_*). |
<commit>... | One or more commit-ish; verification fails as a whole if any one is bad. |
git verify-commit HEADgit verify-commit -v v2.4.0^{commit}git verify-commit --raw HEAD 2>&1 | grep -E '^\[GNUPG:\] (GOODSIG|BADSIG|ERRSIG)'git rev-list origin/main..HEAD | xargs git verify-commitHit each option, then Check answers. Score is recorded; Next is always open.