When trying to deploy a Clojure jar, signing fails with: secret key not available

928 Views Asked by At

I'm trying to deploy my library to-jdbc-url and signing fails:

$ lein release
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
[master 23b2409] Version 0.3.0
 1 file changed, 1 insertion(+), 1 deletion(-)
gpg: skipped "J. Pablo Fernández <[email protected]>": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
error: unable to sign the tag
No credentials found for releases (did you mean `lein deploy clojars`?)
Password prompts are not supported when ran after other (potentially)
interactive tasks.
See `lein help deploy` for an explanation of how to specify credentials.

My key is there:

$ gpg --list-secret-keys
/Users/pupeno/.gnupg/secring.gpg
--------------------------------
sec   2048R/F2FB1C6F 2015-07-15 [expires: 2016-07-14]
uid                  J. Pablo Fernández <[email protected]>
ssb   2048R/E1A0E03B 2015-07-15

and I event installed gpg-agent just in case:

$ gpg-agent
gpg-agent: gpg-agent running and available

I tried with Leiningen 2.5.2 as well as 2.5.1.

What's going on? what am I missing?

2

There are 2 best solutions below

0
On BEST ANSWER

I don't have any experience with lein release nor with signing,

but it stands out that your key has

J. Pablo Fernández <[email protected]>

while you try to use (check letter p)

J. Pablo Fernández <[email protected]>

0
On

I find it most straightforward to set my lein gpg key globally, see here:

https://github.com/technomancy/leiningen/blob/master/doc/GPG.md#overriding-the-gpg-defaults

thus, my ~/.lein/profiles.clj file would look something like:

{:user {:plugins [[lein-auto "0.1.2"]]
        :signing {:gpg-key "<mykey>"}}}

where <mykey> is found by using gpg --list-keys