---
title: "Set the branch a project deploys from"
method: PUT
path: "/projects/{id}/git-connection/production-branch"
tags: ["Projects", "Git Connections"]
---

# Set the branch a project deploys from

`PUT /projects/{id}/git-connection/production-branch`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/projects/{id}/git-connection/production-branch`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Changes only the production branch, leaving the repository binding
alone. PUT /projects/{id}/git-connection can also set it, but that is a
full rebind: it needs connection_id, installation_id and a repository
selector resent, and re-resolves the repository against GitHub for a
field that does not depend on it.

The branch does not have to exist. It is validated as a Git branch name
and nothing more, so a project can be pointed at a branch that is about
to be pushed — the case a repository created empty depends on.

Setting the branch here marks it as the project's own choice, so a later
default-branch rename on GitHub no longer moves it. Projects that never
set one keep following the repository's default branch.

## Path parameters

- `id` string, uuid, required

## Request body

- SetProjectGitProductionBranchRequest
  - `production_branch` string, required: The branch a push must land on to deploy. Validated as a Git branch name only — it does not have to exist yet.

## Response `200`

The project's repo connection, with the new branch

- ProjectGitConnection
  - `repo_installation_id` integer, required
  - `repo_id` integer, required: Stable GitHub repository id (repository.id), the authoritative binding.
  - `repo_full_name` string, required
  - `root_directory` string, required
  - `production_branch` string, required: The branch a push must land on to deploy. Follows the repository's GitHub default branch unless the project set its own, which a default-branch rename on GitHub then leaves alone.
  - `updated_at` string, date-time, required: When the connection last changed: its repository, root directory or production branch. Naming the branch it already uses, and other changes to the project, leave it alone. A connection that has not changed since Volcano began tracking this reports the project's last change before then.

## Other responses

- `400`: Malformed request body, or a production_branch that is not a valid Git branch name
- `401`: Unauthorized - invalid or missing token
- `403`: Project not owned by the caller
- `404`: Project not found, or it has no repository connected. The branch is part of the connection, so there is nothing to set it on until one exists.
- `409`: A Git source transition is pending
- `500`: Failed to set the production branch

## Changes

- **2026-10-07** `23e7875e7c4c`: 1 info
  - the endpoint scheme security `ProjectAccessToken` was added to the API
- **2026-09-19** `3a6f365f3f35`: 7 breaking, 12 info
  - added the new path request parameter `id`
  - the response's body type changed from no type to `object` for status `400`
  - the response's body type changed from no type to `object` for status `401`
  - the response's body type changed from no type to `object` for status `403`
  - …15 more
- **2026-09-04** `c2ec82fb8ce8`: 1 info
  - added the non-success response with the status `409`
- **2026-08-27** `bb44e98aba2e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/git-connection/production-branch/put.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
