Hi!
I’m trying to create a project using REST API with Gitlab configuration and a specific production branch (e.g. main instead of master). I struggle to achieve that using just a single request.
For instance, if a do:
POST/projects
with body:
{
"name": "myprojectname",
"git_remote_url": "https://gitlab.com/myuser/myproject.git",
"git_username": "myuser",
"git_password": "glpat-mytoken",
"git_production_branch_name": "main",
"git_service_name": "gitlab"
}
I get:
POST /projects (500: Internal Server Error)
Body (40 bytes)
{
"error": "Uh oh! Something went wrong."
}
If I use the same body but without specifying git_production_branch_name it works, but it creates a new repository branch named master.
After that, I can update the project using:
PATCH/projects/{project_id}
with body:
{
"git_production_branch_name": "main"
}
And it works, but then I have to remove master branch…
¿Is there a way to achive that using a single request or, at least, without creating a new master branch?
I can’t see this limitation in documentation…
Thanks for help!