简体   繁体   中英

GitLab: Transferring project to Group shows 403 Forbidden error

$ curl -k -X --request POST -H "Private-Token:Gybr7vzbGHuKDv9PM62z" https://gitlab_host/api/v3/groups/2257/projects/2884

{"message":"403 Forbidden"}

I get the above error. The private token I am using is of my userid and I own both the group (groupid=2257) and the project(projectid=2884). I can also transfer the project from the GUI. The above problem is only with the API. What might be the problem?

Looks like only the gitlab administrator is allowed to move a project to a group using the API (see here ).

Transfer a project to the Group namespace. Available only for admin

I found a solution here - to create the project by specifying the namespace_id (groupid). It seems to be adding into the group.

curl -k -X POST -H "Private-Token: XXXXXXXXXXX" " https://gitlab_host/api/v3/projects?name=Team9&namespace_id=2257 "

where 2257 is the groupid.

See GitLab 15.4 (September 2022) can help with:

API endpoint to get group transfer locations

We added a new Groups API endpoint that returns a list of groups to which you can transfer the current group.

See Documentation and Issue .

That way, you can list first the groups to which you can transfer the current group of your current project.
Meaning you will transfer your project to a group you know you can transfer to (no 403)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM