I'm trying to add a key to gpg:

$ gpg --recv-key 12345
gpg: keyserver receive failed: No keyserver available

Then I do this:

$ gpg --list-keys
gpg: /home/me/.gnupg/trustdb.gpg: trustdb created

but the error remains. How can I can fix it?

1 Answer 1


You should specify a keyserver to use.I typically use --keyserver wwwkeys.uk.pgp.net (you can use a lot of different country codes instead of uk, but I know that one works).

  • should I add it to the config instead? should there be whitespace between the 'www' and 'keys' ?
    – Matudi
    Jul 10, 2016 at 21:58
  • 2
    gpg: Note: '--keyserver' is not considered an option
    – Matudi
    Jul 10, 2016 at 21:59
  • No spaces in wwwkeys.uk.pgp.net. You can probably add it your configuration, and it might be a good idea, I've just never bothered to. --keyserver is listed in the man page, so it should work, the complete command will be something like gpg --keyserver wwwkeys.uk.pgp.net --recv-keys 12345678. Jul 10, 2016 at 22:04
  • I think the best practice now is to put the keyserver in .gnupg/gpg.conf
    – jeremiah
    Apr 20, 2017 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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