Git cryptographic signature formats for tags, commits, and mergetags
Git uses cryptographic signatures in various places, including objects (tags, commits, mergetags) and transactions (pushes). The command creating an object or transaction determines a payload, calls an external program to obtain a detached signature, and embeds the signature into the object or transaction.
Normal payload: Signature block appended after the payload (e.g., signed tags)
Object header: Signature in the value of an object header (e.g., mergetag header in merge commits)
When signatures appear in object headers, the multi-line formatting rule applies: second and subsequent lines are prefixed with a space (SP) to signal line continuation.
tree c7b1cff039a93f3600a1d18b82d26688668c7deaparent c33429be94b5f2d3ee9b0adad223f877f174b05dparent 04b871796dc0420f8e7561a895b52484b701d51aauthor A U Thor <author@example.com> 1465982009 +0000committer C O Mitter <committer@example.com> 1465982009 +0000mergetag object 04b871796dc0420f8e7561a895b52484b701d51a type commit tag signedtag tagger C O Mitter <committer@example.com> 1465981006 +0000 signed tag signed tag message body -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 ... -----END PGP SIGNATURE-----Merge tag 'signedtag' into downstream
Verification is embedded in the merge commit message by default, or use git show --show-signature:
git show --show-signature <merge-commit>
The mergetag header preserves the complete signed tag object, including all signature verification information, making it possible to verify the tag signature even after the merge.