Blog

GitHub Unverified Commits With Multiple Accounts: Fix

Commits show Unverified on GitHub when the signature can’t be matched to the account that owns the commit: the signing key isn’t uploaded to that account, or the commit email isn’t a verified email on it. With several GitHub accounts on one Mac, this happens when Git signs with one account’s key but writes another account’s email.

Here is how to read the badge, find which of the two is wrong, and make the identity follow the folder so every account signs with its own key.

Why do my commits say “Unverified” on GitHub?

GitHub shows a badge only in some cases, and they mean different things:

  • Verified: the commit is signed, the signature is valid, and the key belongs to the account matching the committer email.
  • Unverified: the commit is signed, but GitHub can’t validate it. The key is missing from the account, the email doesn’t match, or the key expired.
  • No badge: the commit isn’t signed at all. This is normal unless you turned on vigilant mode, which marks every unsigned commit as Unverified.

So “Unverified” on its own means a signature exists and something about it doesn’t line up. Changing the author email alone won’t clear it.

How do you tell which part is wrong?

Look at what Git actually recorded for the last commit:

git log -1 --show-signature --format='%an <%ae>  signature=%G? key=%GK'

Then check the identity Git will use in this folder:

git config user.email
git config user.signingkey
git config gpg.format

Compare the two with the account you pushed to:

  • The email isn’t one of that account’s verified emails: fix the email.
  • The key isn’t uploaded to that account as a signing key: add it.
  • The key and email belong to different accounts: you were wearing the wrong hat. Fix the identity, then re-sign.

How do you sign commits with a different key per account?

SSH signing is the simplest route on a Mac that already has one SSH key per account. It needs Git 2.34 or later. Put the signing settings next to the other per-account settings:

# ~/.gitconfig-acme
[user]
    email = you@acme.com
    signingkey = ~/.ssh/id_ed25519_acme.pub
[gpg]
    format = ssh
[commit]
    gpgsign = true

Then upload the public key to the same GitHub account, in Settings, SSH and GPG keys, with the key type set to Signing Key. A key uploaded only for authentication is not used to verify commits, even if it is the same file. Finally, make sure the email is added and verified on that account.

GitHub documents the full flow in Telling Git about your signing key.

How do you make each folder use the right signing key?

Set it once per folder with a conditional include, available since Git 2.13 (documented here):

# ~/.gitconfig
[user]
    name = Your Name
    email = you@personal.dev

[includeIf "gitdir:~/clients/acme/"]
    path = ~/.gitconfig-acme

Keep the trailing slash on the path, and put the includeIf after your defaults so the included file wins. Every repository under ~/clients/acme/ now uses the Acme email and the Acme signing key.

This covers email and signing. It does not switch the gh session, and the push key still comes from your SSH setup. Our walkthrough Multiple GitHub Accounts on One Mac covers all four layers, and Git Push Permission Denied to the Wrong GitHub Account covers the authentication side.

Can you fix commits that are already Unverified?

Only by rewriting them, and only if you accept changing history. For your last few unpushed commits:

git rebase -r HEAD~3 --exec 'git commit --amend --no-edit -n -S --reset-author'

--reset-author takes the identity from the current folder, and -S signs again with the configured key. If the commits are already pushed to a shared branch, think twice: rewriting means a force push and new hashes for everyone. For old history, leave it. A gray badge on past commits hurts less than a broken branch.

How do you stop it happening again?

The fix is easy. Remembering it every time is the problem. Hats is a free macOS menu bar app that binds folders to profiles and switches commit email, SSH key, gh account and signing together, then blocks the push when the active hat doesn’t match the folder.

FAQ

Does a wrong email cause “Unverified”?

Only for signed commits. The signature is valid, but if the committer email isn’t verified on the account that owns the key, GitHub can’t confirm it. Unsigned commits with a wrong email show no badge but are attributed to whoever owns that email.

Can I use the same SSH key for two GitHub accounts?

No. GitHub does not accept the same authentication key on two accounts, so give each account its own key and upload it to the right one.

Why are my commits unsigned when I set gpgsign globally?

An includeIf file that sets commit.gpgsign = false, or a repository-level setting, can override the global value. Run git config --show-origin commit.gpgsign to see which file wins.

Do I need GPG, or is SSH signing enough?

SSH signing is enough. GitHub verifies SSH signatures as long as the key is uploaded as a signing key. It is simpler if you already manage SSH keys per account.