---
title: "corestack_deployments_repository_set"
url: https://docs.corefinity.com/mcp/tools/corestack_deployments_repository_set
type: tool
last_updated: 2026-11-13
feature: deployments
related:
  - https://docs.corefinity.com/api/reference/deployments/update-site-deployment-repository.md
  - https://docs.corefinity.com/guides/sites/code-and-deployments/connect-a-repository.md
---
# corestack_deployments_repository_set

**Connect a repository.** Connect a row to a repository and branch through one of the company's Git connections, and choose whether a push deploys it automatically. Scope: write.

- Scope: `write`
- Runs as a task: no

## When to use it

Connect a row to a repository and branch through one of the company's Git connections, and choose whether a push deploys it automatically.

On a WordPress site, `contents` says what the repository holds: `whole_site` (the default) builds each release from the repository; `site_content` (part of the site, such as themes and must-use plugins) copies the live site into each new release and replaces only the top-level folders the repository contains, under `target_path` (`wp-content`, or `web/app` on Bedrock, when it is null). Leave either out to keep what the repository has; `root_directory` does not apply to site content. `corestack_deployments_get` answers `repository_options`: whether site content can be chosen on this row and what a new connection starts from.

## Inputs

- `site_id` (integer, ≥ 1, required)
- `connection_id` (integer, ≥ 1, required)
- `repo` (string, up to 255 characters, required)
- `branch` (string, up to 255 characters, required)
- `root_directory` (string, or null, up to 255 characters): The directory inside the repository to deploy; empty for the root.
- `contents` (string, one of `whole_site`, `site_content`): What the repository holds; omitted keeps the current choice.
- `target_path` (string, or null, up to 255 characters): Site content only: where its folders go, relative to the site root; null for the default; omitted keeps it.
- `auto_deploy` (boolean, required)

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "auto_deploy": {
      "type": "boolean"
    },
    "branch": {
      "maxLength": 255,
      "type": "string"
    },
    "connection_id": {
      "minimum": 1,
      "type": "integer"
    },
    "contents": {
      "description": "What the repository holds: the whole site, or site content (part of a WordPress site, such as themes); omitted keeps the current choice.",
      "enum": [
        "whole_site",
        "site_content"
      ],
      "type": "string"
    },
    "repo": {
      "maxLength": 255,
      "type": "string"
    },
    "root_directory": {
      "description": "The directory inside the repository to deploy; empty for the root.",
      "maxLength": 255,
      "type": [
        "string",
        "null"
      ]
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    },
    "target_path": {
      "description": "Site content only: where its folders go, relative to the site root, such as wp-content; null for the default; omitted keeps it.",
      "maxLength": 255,
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "site_id",
    "connection_id",
    "repo",
    "branch",
    "auto_deploy"
  ],
  "type": "object"
}
```

## Refusals

- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- `invalid_arguments` with `fields.contents`: site content on a site that is not WordPress ("Site content repositories are available for WordPress sites only."), or while Corefinity has paused it; with `fields.target_path`: a target path that is not a folder inside the site, or one kept between deployments, such as `wp-content/uploads`. Nothing was saved.
- `forbidden`: the person's role lacks the Manage Deployment Repositories permission, or `auto_deploy` would switch
  automatic deployment on or off and it lacks the Manage Deployment Source permission, or automatic deployment stays or
  turns on and it lacks the Create Deployments permission (a push that deploys on its own is a deployment, and the
  repository set here is what the next push deploys). The message names the permission and says an owner of the company
  can grant it in Roles; `details.permission` is `manageDeploymentRepositories`, `manageDeploymentSource` or
  `createDeployments`. Nothing is changed. Sent as it already is, `auto_deploy` is no change; it is on only when both the
  environment and its deployments say so. Without Create Deployments, change the repository with `auto_deploy` false
  (which needs Manage Deployment Source while it is on); without either, only while automatic deployment is off in both.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_deployments_repository_set",
  "arguments": {
    "site_id": 4211,
    "connection_id": 12,
    "repo": "corefinity/example-shop",
    "branch": "main",
    "auto_deploy": false
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_deployments_repository_set with site_id 4211, connection_id 12, repo corefinity/example-shop, branch main, auto_deploy false. (Connect a repository.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [PUT /api/corestack/sites/{site}/deployments/repository](https://docs.corefinity.com/api/reference/deployments/update-site-deployment-repository.md)
- Guide: [Connect a repository](https://docs.corefinity.com/guides/sites/code-and-deployments/connect-a-repository.md)
