One Key, Two Accounts

Guide / Daily use

Switch accounts and check Verified commits

#Push to the right account

git push uses whichever account is active in gh. Switch first:

gh auth switch -u you-work       # before pushing work repos
gh auth switch -u you-personal   # before pushing personal repos
gh auth status                   # not sure? check

The commit email and signature don't need switching. They follow the folder (step 5).

#Clone

gh repo clone owner/repo

Clone work repos into ~/work/.

#Is my commit signed?

git log --show-signature -1

Look for Good signature:

gpg: Good signature from "Your Name <you@personal.dev>" [ultimate]
gpg:                 aka "Your Name <you@company.com>" [ultimate]
Author: Your Name <you@company.com>

gpg always names the key's first email, then the others on aka lines. The Author: line shows the email this commit really uses.

#Is it Verified on GitHub?

Open github.com/<owner>/<repo>/commits after pushing. Signed commits show a Verified label.

Extra: mark unsigned commits as unverified

At github.com/settings/keys, turn on Flag unsigned commits as unverified. Then anyone faking commits in your name shows as Unverified.

Edit this page on GitHub