---
title: "Update the linked repository"
method: PATCH
path: "/v1/functions/{functionId}/git-link"
tags: ["Functions"]
---

# Update the linked repository

`PATCH /v1/functions/{functionId}/git-link`

Change the branch, the root directory, or whether pushes deploy. Pass at least one field. `rootDir: null` clears the subdirectory.

## Path parameters

- `functionId` string, required

## Request body

- object
  - `branch` string
  - `rootDir` string, nullable
  - `autoDeploy` boolean

## Response `200`

The link.

- GitRepoLinkResponse
  - `link` GitRepoLink, required — A GitHub repository bound to a function. A push to `branch` deploys the function. A function holds at most one link.
    - `id` string, required
    - `functionId` string, required
    - `provider` 'github', required
    - `owner` string, required
    - `repo` string, required
    - `branch` string, required — Only pushes to this branch deploy.
    - `rootDir` string, nullable — Subdirectory holding the project, for monorepos. Null when the project is at the repository root.
    - `autoDeploy` boolean, required — When false the link is kept and pushes are ignored.
    - `connection` 'app' | 'manual', required — How this link authenticates, decided by the server rather than by the caller. - `app`: the Zavu GitHub App is installed on the account. Pushes arrive on the app's webhook and private repositories work. Nothing to configure in the repository. - `manual`: no installation. The link carries its own secret and you add the webhook to the repository yourself.
    - `lastStatus` 'deploying' | 'deployed' | 'failed' | 'null', nullable
    - `lastCommitSha` string, nullable
    - `lastCommitMessage` string, nullable
    - `lastError` string, nullable — Why the last deploy failed. Null otherwise.
    - `lastDeployAt` string, date-time, nullable
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
  - `webhookUrl` string, uri, required — Endpoint that receives GitHub's push deliveries. Only needed on a `manual` link, where you add it to the repository yourself.
  - `webhookSecret` string — Shared secret for the repository's webhook. **Returned only when creating a `manual` link, and only there** — every later read strips it, and re-linking mints a new one. Absent entirely on an `app` link, which needs no secret of its own.

## Other responses

- `400` — No fields to update, or invalid values.
- `401` — Unauthorized.
- `404` — No repository is linked to this function.

---

[API](https://skmtc.net/zavudev/apis/zavu-unified-messaging-layer-api.md) · [All operations](https://skmtc.net/zavudev/apis/zavu-unified-messaging-layer-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zavudev/zavu-unified-messaging-layer-api/versions/07b87b6ae707/schema)
