The Case of the Missing Signature: A Git SSH Signing Mystery
It was a quiet afternoon. I had just finished a solid coding session on my project, commits neatly stacked like a tower of accomplishments. Time to push to GitHub and call it a day.
Then I noticed something odd.
The Discovery
I wanted to check if my commits were properly signed—you know, that satisfying green "Verified" badge on GitHub. So I ran the usual:
git log --show-signature
And there it was. The dreaded output:
commit abc123def456...
No signature
Author: CaiBorui <borui_cai@qq.com>
Wait, what? No signature? But I had SSH signing configured! I remember setting it up. The -S flag was there. What happened to my signatures?
Down the Rabbit Hole
I refused to accept this. Something felt off. So I decided to peek under the hood and check the raw commit data:
git cat-file -p HEAD
And lo and behold:
tree 789abc...
parent 456def...
author CaiBorui <borui_cai@qq.com> 1705123456 +0800
committer CaiBorui <borui_cai@qq.com> 1705123456 +0800
gpgsig -----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAg...
...more cryptic characters...
-----END SSH SIGNATURE-----
feat: add awesome feature
The signature was RIGHT THERE! -----BEGIN SSH SIGNATURE----- staring back at me!
So the commits were signed. Git just... couldn't see them?
The Revelation
After some digging, I finally understood the problem. Git was like a security guard who had been given a package but didn't know whose handwriting to trust. The signature existed, but git had no idea whose public key to verify it against.
It's like receiving a letter with a wax seal, but having no idea whose seal it is. Is it the king's? A fraud's? Without a reference, you simply can't verify.
That's where allowed_signers comes in.
The Solution
The allowed_signers file is essentially git's address book of trusted signers. It maps email addresses to public keys, telling git: "Hey, if you see a signature from this email, verify it against this public key."
Step 1: Create the allowed_signers file
echo "[email protected] $(cat ~/.ssh/id_ed25519.pub)" > ~/.ssh/allowed_signers
The format is simple: email key-type public-key
Step 2: Tell git where to find it
git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
The Moment of Truth
Heart pounding, I ran the command again:
git log --show-signature
And there it was. Beautiful. Perfect. Glorious:
commit abc123def456...
Good "git" signature for borui_cai@qq.com with ED25519 key SHA256:NzjA/V8S+y+ixGvPRcBV7p6EPIgJULReoBL1jOiUm6E
Author: CaiBorui <borui_cai@qq.com>
Good signature. Two words that made my afternoon.
Lessons Learned
| What I Thought | What Was Actually Happening |
|---|---|
| "My commits aren't signed" | Commits were signed, just not verifiable |
| "SSH signing is broken" | SSH signing was fine, verification was misconfigured |
| "I need to re-sign everything" | I just needed to tell git how to verify |
Bonus: Signing Old Commits
While I was at it, I also learned how to retroactively sign all commits in a repo:
git rebase --root --exec 'git commit --amend --no-edit -S' --committer-date-is-author-date
📓 Note:
--committer-date-is-author-datekeeps your original timestamps intact. Without it, all your commits will look like they were made today.
Final Thoughts
The allowed_signers file is to git what known_hosts is to SSH—a trust anchor. Without it, git can store signatures but can't verify them. It's one of those "obvious in hindsight" configurations that can leave you scratching your head for hours.
So if you ever find yourself staring at "No signature" while knowing full well you signed those commits, remember: the signature might be there. Git just needs to know whose handwriting to trust.
Mystery solved. Commits verified. Time for coffee.