go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.12k stars 5.32k forks source link

unauthorized: reqPackageAccess when pushing to container registry #31531

Closed dlmw closed 2 days ago

dlmw commented 1 week ago

Description

I successfully logged in to my user with docker login. I logged in with my usual username/password. When I push the image, I get the error unauthorized: reqPackageAccess.

What's the issue?

Gitea Version

1.22.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker Swarm

Database

PostgreSQL

kemzeb commented 1 week ago

Thanks for the bug report! Are there any logs that you would be able to provide from your Gitea instance associated with you pushing to your registry?

dlmw commented 2 days ago
2024/07/07 08:32:03 ...eb/routing/logger.go:102:func1() [I] router: completed POST /v2/dlmw/minecraft/blobs/uploads/ for 10.0.0.2:0, 401 Unauthorized in 1.1ms @ packages/api.go:42(packages.ContainerRoutes.func2.1.reqPackageAccess.4)
2024/07/07 08:32:03 ...eb/routing/logger.go:102:func1() [I] router: completed POST /v2/dlmw/minecraft/blobs/uploads/ for 10.0.0.2:0, 401 Unauthorized in 1.1ms @ packages/api.go:42(packages.ContainerRoutes.func2.1.reqPackageAccess.4)

I think those are the relevant ones.

delvh commented 2 days ago

You need to supply a PAT to authenticate yourself to Gitea (this has nothing to do with Docker). Your token needs either packages.Read or packages.Write permission, in this case probably write, and you must be allowed to push a package to the given user.,

dlmw commented 2 days ago

How do I do that if it's not related to Docker?

delvh commented 2 days ago

grafik

dlmw commented 2 days ago

Thank you. A bit off-topic but is there a way to push an image to a repository instead of a user?

delvh commented 2 days ago

No, but you can link a package to a repo once it has been pushed.