Guide / Add the key to GitHubStep 3 of 5
Add the GPG key to both GitHub accounts
#Export it
gpg --armor --export <KEY_ID> > key.ascThis is the public part, so it's safe to paste on GitHub.
#Way 1: Browser (easiest)
Do this once on each account:
- Sign in to GitHub as that account.
- Open github.com/settings/gpg/new.
- Title:
My Laptop. - Paste everything inside
key.asc, from-----BEGINto-----END. - Click Add GPG key.
#Way 2: Terminal with gh
gh auth switch -u you-personal
gh auth refresh -h github.com -s write:gpg_key # one-time browser approval
gh gpg-key add key.asc --title "My Laptop"
gh auth switch -u you-work
gh auth refresh -h github.com -s write:gpg_key # browser must be signed in as work
gh gpg-key add key.asc --title "My Laptop"#Check
On github.com/settings/keys the key lists its emails. That account's own email should say Verified. The other account's email showing Unverified there is normal.
Same key on two accounts? GitHub accepts it (tested in October 2026). If it ever answers "Key is already in use", make a second key just for work: one key per account.
Added another email to the key later? Export it again and re-upload. GitHub only knows the emails it saw at upload time.