clojars / clojars-web

A community repository for open-source Clojure libraries
https://clojars.org
Eclipse Public License 1.0
468 stars 114 forks source link

lein deploy fails, not getting prompted for password/deploy token #858

Closed simon-brooke closed 1 year ago

simon-brooke commented 1 year ago

Hi, I've been trying to deploy a release, and am getting problems with lein deploy (full error output below).

Briefly:

when I run lein deploy clojars, my deploy artefacts get built, signed and despatched. I am not prompted for my username; I am not prompted for a password; I am not prompted for a deploy token. The deployment fails with a 401 Unauthorised error.

Do I need to delete my ~/.lein/credentials.clj.gpg?

illuminator:sparse-array simon$ lein deploy clojars
Compiling sparse-array.core
WARNING: get already refers to: #'clojure.core/get in namespace: sparse-array.core, being replaced by: #'sparse-array.core/get
Compiling sparse-array.extract
Created /Users/simon/workspace/sparse-array/target/sparse-array-0.3.0.jar
Wrote /Users/simon/workspace/sparse-array/pom.xml
Need to sign 2 files with GPG
[1/2] Signing /Users/simon/workspace/sparse-array/target/sparse-array-0.3.0.jar with GPG
gpg: using "[redacted]" as default secret key for signing
[2/2] Signing /Users/simon/workspace/sparse-array/pom.xml with GPG
gpg: using "[redacted]" as default secret key for signing
Sending sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.jar (69k)
    to https://repo.clojars.org/
Could not transfer artifact sparse-array:sparse-array:jar:0.3.0 from/to clojars (https://repo.clojars.org/): Transfer failed for https://repo.clojars.org/sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.jar 401 Unauthorized - a deploy token is required to deploy. See https://bit.ly/3LmCclv
Sending sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.pom (3k)
    to https://repo.clojars.org/
Could not transfer artifact sparse-array:sparse-array:pom:0.3.0 from/to clojars (https://repo.clojars.org/): Transfer failed for https://repo.clojars.org/sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.pom 401 Unauthorized - a deploy token is required to deploy. See https://bit.ly/3LmCclv
Sending sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.jar.asc (1k)
    to https://repo.clojars.org/
Could not transfer artifact sparse-array:sparse-array:jar.asc:0.3.0 from/to clojars (https://repo.clojars.org/): Transfer failed for https://repo.clojars.org/sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.jar.asc 401 Unauthorized - a deploy token is required to deploy. See https://bit.ly/3LmCclv
Sending sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.pom.asc (1k)
    to https://repo.clojars.org/
Could not transfer artifact sparse-array:sparse-array:pom.asc:0.3.0 from/to clojars (https://repo.clojars.org/): Transfer failed for https://repo.clojars.org/sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.pom.asc 401 Unauthorized - a deploy token is required to deploy. See https://bit.ly/3LmCclv
Failed to deploy artifacts: Could not transfer artifact sparse-array:sparse-array:jar:0.3.0 from/to clojars (https://repo.clojars.org/): Transfer failed for https://repo.clojars.org/sparse-array/sparse-array/0.3.0/sparse-array-0.3.0.jar 401 Unauthorized - a deploy token is required to deploy.
tobias commented 1 year ago

Hi @simon-brooke:

To deploy to Clojars, you have to use your username as the username, and a deploy token as the password. If you have an entry for Clojars in credentials.clj.gpg and have :creds :gpg set for Clojars in your project.clj or ~/.lein/profiles.clj, lein will use that an not prompt, so that entry has to be your username and deploy-token-as-password.

If you remove :creds :gpg from whatever place you have it set, lein should ignore your credentials file and prompt.

The 401 Unauthorized - a deploy token is required to deploy. from Clojars indicates that it is getting a password value, but it isn't the correct shape to be a deploy token.

simon-brooke commented 1 year ago

Thank you for your very fast and helpful response.

I didn't in fact have :creds :gpg set anywhere, but I do have :signing {:gpg-key "[redacted]"} set in my .lein/profiles.clj; I also had my Clojars credentials in .lein/credentials.clj.gpg. I backed up and deleted the credentials file, and tried lein deploy; this worked.