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

1
2
3
4
5
6
7
gpg --list-secret-keys --keyid-format LONG

#=> ~/.gnupg/secring.gpg
#=> ------------------------------------------
#=> sec   4096R/THISISMYKEY 2016-11-04
#=> uid                          Fernando Paredes <email@example.com>
#=> ssb   4096R/THISISMYSSB 2016-11-04

Edit Key

1
gpg --edit-key THISISMYKEY

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

1
2
3
4
5
6
gpg> adduid

#=> Real Name: Newt Scamander
#=> Email address: newt@scamander.com
#=> 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.

1
gpg --armor --export | pbcopy