# How to set a project git default production branch using REST API

**URL:** <https://discuss.google.dev/t/how-to-set-a-project-git-default-production-branch-using-rest-api/388061>\
**Category:** Looker\
**Tags:** admin, api\
**Created:** [August 6, 2026, 11:32am UTC](https://discuss.google.dev/t/how-to-set-a-project-git-default-production-branch-using-rest-api/388061 "2026-08-06T11:32:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillem\_Valls\_Argeri](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/guillem_valls_argeri/32/185241_2.png) [@Guillem\_Valls\_Argeri](https://discuss.google.dev/u/Guillem_Valls_Argeri)\
**Post date:** [August 6, 2026, 11:32am UTC](https://discuss.google.dev/t/how-to-set-a-project-git-default-production-branch-using-rest-api/388061/1 "2026-08-06T11:32:09Z")

</div>

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:

```json
{
  "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:

```auto
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:

```json
{
  "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!
