While attempting to install Ansible from an official APT repository, you may see a missing public GPG key error.
This can happen when you add a repository, and you forget to add its public key.
In this short note i am showing how to fix the GPG error NO_PUBKEY 93C4A3FD7BB9C367.
Fix GPG error “NO_PUBKEY 93C4A3FD7BB9C367”
If you try to install Ansible from the official APT repository without adding its public key, you may get the error as follows:
W: GPG error: http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 93C4A3FD7BB9C367 E: The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
To fix this error, simply import the repository’s GPG key using the following command:
$ curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x93C4A3FD7BB9C367" | sudo apt-key add
Thank you!