401 Unauthorized while issuing maven deploy #10454

Closed
opened 2025-11-02 09:07:52 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @rkern62 on GitHub (Mar 19, 2023).

Description

While trying to perform a Maven deploy (mvn deploy) to a gitea hosted registry the operation fails with 401 - Authorization. The corresponding log entry is:
2023/03/19 13:40:49 [641710e1-3] router: completed PUT /api/packages/greeen-ambient/maven/org/example/testpipeline-02/1.0-SNAPSHOT/testpipeline-02-1.0-20230319.134051-1.pom for 192.168.178.66:57133, 401 Unauthorized in 3.2ms @ packages/api.go:38(packages.reqPackageAccess)
The operation doesn't work with user:password credentials nor with an authentication token. I tried all sorts of permissions without success. A deployment of files to the generic endpoint does work as expected.
Many thanks in advance.

Gitea Version

1.20.0+dev-181-g6f9cc617f

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

ubuntu

How are you running Gitea?

Running gitea within a docker container utilizing a postgres database.

Database

PostgreSQL

Originally created by @rkern62 on GitHub (Mar 19, 2023). ### Description While trying to perform a Maven deploy (mvn deploy) to a gitea hosted registry the operation fails with 401 - Authorization. The corresponding log entry is: 2023/03/19 13:40:49 [641710e1-3] router: completed PUT /api/packages/greeen-ambient/maven/org/example/testpipeline-02/1.0-SNAPSHOT/testpipeline-02-1.0-20230319.134051-1.pom for 192.168.178.66:57133, 401 Unauthorized in 3.2ms @ packages/api.go:38(packages.reqPackageAccess) The operation doesn't work with user:password credentials nor with an authentication token. I tried all sorts of permissions without success. A deployment of files to the generic endpoint does work as expected. Many thanks in advance. ### Gitea Version 1.20.0+dev-181-g6f9cc617f ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System ubuntu ### How are you running Gitea? Running gitea within a docker container utilizing a postgres database. ### Database PostgreSQL
GiteaMirror added the topic/packagesissue/needs-feedback labels 2025-11-02 09:07:52 -06:00
Author
Owner

@KN4CK3R commented on GitHub (Mar 20, 2023):

The operation doesn't work with user:password credentials nor with an authentication token. I tried all sorts of permissions without success.

What exactly did you try? https://docs.gitea.io/en-us/packages/maven/#configuring-the-package-registry shows how the registry should be configured.

@KN4CK3R commented on GitHub (Mar 20, 2023): > The operation doesn't work with user:password credentials nor with an authentication token. I tried all sorts of permissions without success. What exactly did you try? https://docs.gitea.io/en-us/packages/maven/#configuring-the-package-registry shows how the registry should be configured.
Author
Owner

@rkern62 commented on GitHub (Mar 20, 2023):

I configured the settings.xml with the following part:

       <servers>
            <server>
              <id>gitea</id>
              <configuration>
                <httpHeaders>
                  <!--
                  <property>
                    <name>Authorization</name>
                    <value>token ljllllajfaösjfajföl</value>
                  </property>
                  -->
                  <property>
                    <name>username</name>
                    <value>repo01</value>
                  </property>
                  <property>
                    <name>password</name>
                    <value>xxxx</value>
                  </property>
                </httpHeaders>
              </configuration>
            </server>
          <servers>

I tried with a specific user (username/password) as well as with an authorization token, with scope package.

@rkern62 commented on GitHub (Mar 20, 2023): I configured the settings.xml with the following <server> part: ``` <servers> <server> <id>gitea</id> <configuration> <httpHeaders> <!-- <property> <name>Authorization</name> <value>token ljllllajfaösjfajföl</value> </property> --> <property> <name>username</name> <value>repo01</value> </property> <property> <name>password</name> <value>xxxx</value> </property> </httpHeaders> </configuration> </server> <servers> ``` I tried with a specific user (username/password) as well as with an authorization token, with scope package.
Author
Owner

@KN4CK3R commented on GitHub (Mar 20, 2023):

Works as intended for me with the token:

[INFO] --- deploy:3.0.0:deploy (default-deploy) @ maven-package ---
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.pom (5.3 kB at 267 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.jar (262 kB at 5.5 MB/s)
Downloading from gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-metadata.xml
Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.pom
Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.pom (1.1 kB at 6.6 kB/s)
Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.jar
Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.jar (2.1 kB at 16 kB/s)
Downloading from gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml
Downloaded from gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml (231 B at 3.0 kB/s)
Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-metadata.xml
Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-metadata.xml (765 B at 6.1 kB/s)
Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml
Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml (0 B at 0 B/s)
@KN4CK3R commented on GitHub (Mar 20, 2023): Works as intended for me with the token: ``` [INFO] --- deploy:3.0.0:deploy (default-deploy) @ maven-package --- Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.pom (5.3 kB at 267 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.1/plexus-utils-3.3.1.jar (262 kB at 5.5 MB/s) Downloading from gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-metadata.xml Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.pom Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.pom (1.1 kB at 6.6 kB/s) Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.jar Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-package-1.0-20230320.131721-1.jar (2.1 kB at 16 kB/s) Downloading from gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml Downloaded from gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml (231 B at 3.0 kB/s) Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-metadata.xml Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/1.0-SNAPSHOT/maven-metadata.xml (765 B at 6.1 kB/s) Uploading to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml Uploaded to gitea: https://my-gitea/api/packages/KN4CK3R/maven/io/gitea/maven-package/maven-metadata.xml (0 B at 0 B/s) ```
Author
Owner

@rkern62 commented on GitHub (Mar 20, 2023):

I've to apologize. While doing some more problem determination, I found, the settings.xml was not in the right place.
While testing with the Actions workflow, it is not always easy to see what's going on under the hoods.
Thank you very much for your support.

@rkern62 commented on GitHub (Mar 20, 2023): I've to apologize. While doing some more problem determination, I found, the settings.xml was not in the right place. While testing with the Actions workflow, it is not always easy to see what's going on under the hoods. Thank you very much for your support.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10454