How to deploy your library to Clojars (on macOS)
I wanted to publish my clojure library to Clojars,
but documents or how-tos about it were too complicated or outdated,
so I’m writing ths post for the record.
It was tested on my macOS machine.
1. Generate your gpg key,
Generate a gpg key with a passphrase,
2. Deploy to Clojars
Then you’ll be asked to enter your Clojars username, password, and gpg key’s passphrase.
If nothing goes wrong, you library will be uploaded to Clojars.
1. GPG signing fails while deploying to Clojars
If you suffer from this error:
gpg: signing failed: Inappropriate ioctl for device,
lein deploy clojars again.
2. Don’t want to type username and password again and again
If you don’t want to type your username and password everytime,
you can avoid it by creating
.lein/credentials.clj.gpg file by:
and fill it with:
then convert it with:
lein deploy clojars will not ask your username and password.
3. GPG decryption fails while deploying to Clojars
If you see following kind of error:
decrypt your gpg key once,
lein deploy clojars.
4. cljdoc complains about ‘unknown-revision’
When you see:
unknown-revision This issue may occur if you deployed to Clojars before pushing the Git commit the release was made at.
in your cljdoc page, check if you included your scm information in the project file.
If it is already set correctly, make sure you have checked-out the right branch when deploying to Clojars.
It also can be due to the wrong git tag (eg. which is not pushed to the scm yet) included in the package.