Transfer subkey to other keyring

Henry Hertz Hobbit hhhobbit at
Tue Jun 25 23:44:46 CEST 2013

On 06/25/2013 06:12 PM, Jack Bates wrote:
> Hello, I want to transfer a subkey from one keyring to another, but I
> get the following error:
>    gpg: key 7FABB65F: already in secret keyring
>    gpg: Total number processed: 1
>    gpg:       secret keys read: 1
>    gpg:  secret keys unchanged: 1
> Here is the command I am running:
>    $ gpg --homedir . --export-options export-reset-subkey-passwd \
> --export-secret-subkeys 10D03493\! | gpg --import-options merge-only \
> --import
> The destination keyring does not already contain the subkey 10D03493
> (and unfortunately it still does not contain it after running the command)
> What am I doing wrong?

Why are you setting --homedir to the current folder (.) and where
are you at when you are running the command?  I added some
back-slashes for clarity since my mailer wrapped (sorry).

You say one keyring to another which implies two directories
(folders).  IOW, the command implies you are trying to export
from the folder you are in which is NOT ${HOME}/.gnupg into
${HOME}/.gnupg (you took the default for the second gpg which
is ${HOME}/.gnupg unless you set environment variable GNUPGHOME
to something else.  But the error seems to indicate:

1. You are in  ${HOME}/.gnupg, e.g., you did a:
   $cd ~/.gnupg

2. You are setting the the --homedir explicitly to "."
   which is now ${HOME}/.gnupg for export and the
   import is also going to ${HOME}/.gnupg (same folder)
   implicitly unless you over-rode it with the environment
   variable GNUPGHOME to be something else.

The error seems to indicate you are importing to the same
folder you are exporting from.  I would suggest using the
--homedir with the actual ${HOME}/FROM-DIR-PATH for the
first gpg and --homedir with the actual ${HOME}/TO-DIR-PATH
for the second gpg.  That makes it explicit where it is
coming from and going to.

I leave it to others to say whether the commands once
that is handled are correct.  It seems to be from the
man pages but since I have never done it ...

More information about the Gnupg-users mailing list