Fail to upload to package registry for a group (404 Not Found)

Hi there, I’ve been following the PyPI guide with GitLab package registry, and unfortunately, I’m having issues connecting and publishing to the registry when using a group instead of a project. The command I’m using is the following.

twine upload --repository-url https://gitlab.com/api/v4/groups/group_id/-/packages/pypi dist/*

where group_id above is replaced by the actual group id I’m trying to use. I’ve also tried with the project version of urls instead of group, and it works fine with a project url.

Yet I’m getting 404 errors as follows (with group_id instead of actual one)

INFO     Response from https://gitlab.com/api/v4/groups/group_id/-/packages/pypi:
         404 Not Found
INFO     {"error":"404 Not Found"}
ERROR    HTTPError: 404 Not Found from https://gitlab.com/api/v4/groups/group_id/-/packages/pypi
         Not Found

I have the same rights in both the group id and the repository I tested, and copy pasted the group id from the group page to be sure to not make a silly mistake, the group id seems correct.

Has anyone any idea of what I’m doing wrong?

We had a similar issue. The group ‘registry’ seems to be merely a reference to the underlying project registries. See also Publishing to gitlab pypi package registry for a group - Stack Overflow

This explains why on the docs page you linked to there is a section dubbed ’ Authenticate to access packages within a group’, which would allow access to the packages of all underlying projects, but no mention of publishing directly to a group.

1 Like