1

Using the --keyring option, I'm unable to export public keys with gpg:

$ gpg -vv --armor --keyring pubring.gpg --export
gpg: writing to stdout
gpg: WARNING: nothing exported

Yet it works with --homedir:

$ gpg --armor --homedir . --export 
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)
...

What's the reason for this? Is there a workaround?

1

From the gpg man page:

--keyring file
             Add file to the current list of  keyrings.   If  file  begins
             with  a  tilde  and  a slash, these are replaced by the $HOME
             directory. If the filename does not contain a  slash,  it  is
             assumed  to  be  in  the  GnuPG home directory ("~/.gnupg" if
             --homedir or $GNUPGHOME is not used).

The filename given to --keyring (and other options, like --secret-keyring and --trustdb-name) must have a slash in it, otherwise gpg looks for it in the GnuPG home directory.

You would want to use:

gpg -vv --armor --keyring ./pubring.gpg --export

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.