If I have multiple OpenPGP keys in GnuPG with the same user ID/e-mail address, how can I distinguish between them?

I have multiple OpenPGP keys that I am managing with GPG. The problem is, they have the same user ID and the same e-mail address. How do I tell GPG the difference when I am, say, encrypting a file?


You can always use a key ID instead of a user ID. For example, for encrypting a message to my newer key:

gpg --encrypt --recipient A4FF2279

In case of ambiguous key IDs, you might need to use a longer id or the full fingerprint.