4
votes

I want to deploy a Clojure library using Leiningen. I have done the following things:

  • installed gpg
  • created a gpg key-pair
  • encrypted my Clojars credential into ~/.lein/credentials.clj.gpg
  • installed gpg-agent
  • installed Keychain

When I call 'lein deploy clojars', I get the following output:

WARNING: please set :license in project.clj.
Could not decrypt credentials from ~/.lein/credentials.clj.gpg
gpg: can't query passphrase in batch mode
gpg: decryption failed: secret key not available

See `lein help gpg` for how to install gpg.
No credentials found for clojars
See `lein help deploy` for how to configure credentials.
Username:

I then uninstalled gpg, installed gpg2 and made a symlink from gpg to gpg2. When I now call 'lein deploy clojars', I get:

WARNING: please set :license in project.clj.
^CCould not decrypt credentials from ~/.lein/credentials.clj.gpg
pinentry-curses: no LC_CTYPE known - assuming UTF-8
pinentry-curses: no LC_CTYPE known - assuming UTF-8
pinentry-curses: no LC_CTYPE known - assuming UTF-8
pinentry-curses: no LC_CTYPE known - assuming UTF-8

gpg: signal Interrupt caught ... exiting

See `lein help gpg` for how to install gpg.
No credentials found for clojars
See `lein help deploy` for how to configure credentials.
Username: 

After the warning, the command waits for an input, from which I can only exit by pressing ctrl-c.

Can anyone tell me what I need to do in order to deploy the library?

1

1 Answers

2
votes

lein made deploying to clojars as simple as possible with lein-clojar plugin.

First, create ~/.lein/profiles.clj file with the following content:

{:user {:plugins [[lein-clojars "0.9.1"]]}}

Unfortunately, you can't use passphrased keys with lein-clojar plugin, but you can generate new ssh key with lein keygen command. It will place new ssh key into ~/.leiningen/, so it will be used only by lein.

After generating a key, lein will print its public part to the console. You should copy it to your clojars account.

At last, you can deploy your project with lein push.

Of course, you can deploy your project without this plugins using lein deploy clojars and any ssh or pgp key. Probably, it's possible to use pathphrased keys with lein deploy clojars, but I'm not sure about it.