I recently came across an issue when I was signing commits that also used my business email.

github gpg unverified

I gladly learned that it’s not very hard to add an additional user id to a GPG key.

Get Current Secret Key ID

To start, we need to get our current secret key id. We’re looking for the sec key. We can ignore the bit length

gpg --list-secret-keys --keyid-format LONG
 
#=> ~/.gnupg/secring.gpg
#=> ------------------------------------------
#=> sec   4096R/THISISMYKEY 2016-11-04
#=> uid                          Fernando Paredes <[email protected]>
#=> ssb   4096R/THISISMYSSB 2016-11-04

Edit Key

gpg --edit-key THISISMYKEY

--edit-key will drop us into gpg’s REPL. From here we can add our additional user ID:

gpg> adduid
 
#=> Real Name: Newt Scamander
#=> Email address: [email protected]
#=> Comment: Fantastic Beasts
#=> Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

Github

We’ll need to add our key to Github. If you’ve already added the key to Github, you’ll need to delete it and paste in your new key.

gpg --armor --export | pbcopy