Dealing with duplicate keys

Ludovic Courtès ludo at
Wed Oct 21 23:52:08 CEST 2020


For some reason (perhaps a bug in a previous version of GnuPG I used
long ago?), my public key ring had come to contain my own public key
twice, with the same fingerprint and all.

Consequently, ‘gpg --list-keys’ would show it twice and ‘gpg
--list-secret-keys’ as well.  Even ‘gpg --export-secret-key’ would
export it twice (two secret key packets).

I didn’t notice until I upgraded to Emacs 27.1, where epg bails out if
‘--list-secret-keys’ returns more than one key.

To recover from it, I deleted my public key with ‘--delete-key’ twice,
‘--delete-secret-key’ once for the corresponding secret key, and then
re-imported both the public key and the secret key, which I had
previously exported.  Now everything is back to normal.

I’m not sure what could be done in gpg itself, but I thought I’d share
my experience in case that rings a bell or there’s something obvious I


More information about the Gnupg-users mailing list