---
title: "Connect or update a project's repo connection"
method: PUT
path: "/projects/{id}/git-connection"
tags: ["Projects", "Git Connections"]
---

# Connect or update a project's repo connection

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

## Request

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

Full replace, following Vercel's model: many projects may point at the
same repo, so this only binds the project — it never creates or
deletes git-provider state. Used for both the initial connect and
later edits (repo change, root directory, production branch).
Resolves the repository_id or repo_full_name selector against the repos
accessible through installation_id via connection_id's stored GitHub
user token, then persists repository metadata only from that validated
GitHub response.

Project access tokens are refused. Which repository a project deploys
from is a person's decision, made with a platform token or in the
dashboard. A project access token can still change the root directory
and production branch through PUT
/projects/{id}/git-connection/root-directory and PUT
/projects/{id}/git-connection/production-branch.

## Path parameters

- `id` string, uuid, required

## Request body

- ConnectProjectGitRequest
  - `connection_id` string, uuid, required: The caller's user_git_connections row (see /user/git/connections).
  - `installation_id` integer, required
  - `repository_id` integer: Stable GitHub repository id (repository.id), the preferred selector. Either repository_id or repo_full_name is required; when both are given they must identify the same live repository.
  - `repo_full_name` string: Deprecated selector kept for a compatibility window; prefer repository_id. Either repository_id or repo_full_name is required.
  - `root_directory` string: Monorepo subdirectory the project builds from. Omit for the repo root.
  - `production_branch` string: The branch a push must land on to deploy, with three cases, because this is a full replace and a read-modify-write client sends back whatever it read. Omit it to follow the repository's GitHub default branch, which also discards a branch set earlier. Send back the branch the project already deploys from, when that is the repository's default, and nothing changes either way — a project pinned to that branch stays pinned. Sending the default branch when the project deploys from something else returns it to following the default, including on a rebind, where a pin describes a branch chosen for the repository being left. Any other branch becomes the project's own choice, exempt from later default-branch renames. Validated as a Git branch name only: it does not have to exist yet, so a project can be pointed at a branch about to be pushed. Changing repository and naming a branch other than the new repository's default in one request is refused with 400, because the branch named is almost always the previous repository's, echoed back — connect first, then set the branch.

## Response `200`

The project's repo connection

- 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, no repository selector, selectors that identify different repositories, a production_branch that is not a valid Git branch name, no production_branch on a repository with no default branch to follow (name one to connect a repository that has no commits yet), or a production_branch other than the new repository's default in a request that also changes repository.
- `401`: Unauthorized - invalid or missing token
- `403`: Project not owned by the caller, the selected repository is not accessible through installation_id, or the request used a project access token. A full-scope token gets `project access tokens cannot change a project's repository; a person changes it in the dashboard or with a platform token`, and a read-only token gets `project access token is read-only`.
- `404`: Project or connection not found
- `409`: A Git source transition is pending or complete, so the recorded repository and root cannot be changed
- `500`: Failed to connect project git
- `503`: Git provider integration is not configured

## Changes

- **2026-10-26** `4b0676e06128`: 1 info
  - the endpoint scheme security `ProjectAccessToken` was removed from the API
- **2026-10-07** `23e7875e7c4c`: 1 info
  - the endpoint scheme security `ProjectAccessToken` was added to the API
- **2026-09-19** `3a6f365f3f35`: 8 breaking, 14 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`
  - …18 more
- **2026-09-04** `c2ec82fb8ce8`: 1 info
  - added the non-success response with the status `409`
- **2026-08-27** `bb44e98aba2e`: 12 breaking, 8 warning, 1 info
  - the response's body type changed from `object` to no type for status `400`
  - the response's body type changed from `object` to no type for status `401`
  - the response's body type changed from `object` to no type for status `403`
  - the response's body type changed from `object` to no type for status `404`
  - …17 more

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/git-connection/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)
