How do i add the pgp key from a terminal?

i have added the deb http://badgerports.org lucid main to sources.list and when i do a sudo apt-get update i get

W: GPG error: http://badgerports.org lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C90F9CB90E1FAD0C

this is the key i need to add http://badgerports.org/directhex.ppa.asc

4 Answers 4


This command will get the public key for the repo :

gpg --keyserver pgpkeys.mit.edu --recv-key C90F9CB90E1FAD0C && gpg --export --armor C90F9CB90E1FAD0C | sudo apt-key add -

It works for any repository, you just have to replace the public key number in the command with the one from the error message.


First run wget http://badgerports.org/directhex.ppa.asc and then run:

sudo apt-key add directhex.ppa.asc


There is also a script that automatically finds and adds all missing keys. It can be downloaded from Launchpad and is supported in Jaunty, Karmic, Lucid, Maverick.

Ubuntu 10.10 Maverick Meerkat

Ubuntu 10.04 Lucid Lynx

Ubuntu 9.10 Karmic Koala

Ubuntu 9.04 Jaunty Jackalope

After installation you simply run sudo launchpad-getkeys


The answer didn't work in with the key of my repository because i wasn't in pgpkeys.mit.edu. The way it worked for me in ubuntu 20.04 was:

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys PUT_THE_KEY_HERE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.