---
title: "Repositories and webhooks"
url: https://docs.corefinity.com/guides/corestack-enterprise/repositories-and-webhooks
type: guide
last_updated: 2026-11-13
feature: enterprise-deployments
related:
  - https://docs.corefinity.com/api/reference/enterprise/list-environment-deployment-pipelines.md
  - https://docs.corefinity.com/api/reference/enterprise/get-environment-deployment-settings.md
  - https://docs.corefinity.com/api/reference/enterprise/update-environment-deployment-settings.md
  - https://docs.corefinity.com/api/reference/enterprise/list-environment-deployments.md
  - https://docs.corefinity.com/api/reference/enterprise/create-environment-deployment.md
  - https://docs.corefinity.com/api/reference/enterprise/get-environment-deployment.md
  - https://docs.corefinity.com/mcp/tools/corestack_enterprise_deployment_settings_get.md
  - https://docs.corefinity.com/mcp/tools/corestack_enterprise_deployment_settings_update.md
  - https://docs.corefinity.com/mcp/tools/corestack_enterprise_repositories_list.md
  - https://docs.corefinity.com/mcp/tools/corestack_enterprise_repository_set.md
  - https://docs.corefinity.com/mcp/tools/corestack_enterprise_repository_remove.md
  - https://docs.corefinity.com/mcp/tools/corestack_enterprise_deployments_list.md
---
# Repositories and webhooks

Choose the Git repository and branch a CoreStack Enterprise environment deploys from, and deploy on every push.

## Before you start

- You can open the environment: see [Websites and environments](/guides/corestack-enterprise/websites-and-environments).
- You are an owner, or your role has **Manage Deployment Repositories** for the repository rows and **Manage Deployment Source** for **Deployment Source** and **Git Deployment Type**.
- Your organisation has connected its GitHub, GitLab or Bitbucket account: see [Repository connections](/guides/organisation/developers/repository-connections).

## Add a repository

1. **Open Repositories**

   Open the environment and choose **Deployments**. Set **Deployment Source** to **GIT**, then choose the **+** button beside **Repositories**.

   _Screenshot: Deployment Source set to GIT above Repositories: one repository row with its pipeline, the repository northwind-digital/northwind-outdoor, the branch main and the folder, and the + and × buttons._

2. **Fill in the row**

   Choose the pipeline under **Select pipeline** and the connected account under **Select provider**, then the repository and the branch. The last box is the folder of the repository to deploy from, such as `/`.

3. **Save**

   Choose the tick at the end of the row.

The repository is saved, and the Control Panel adds its webhook to it.

## Deploy on every push

1. **Set Git Deployment Type**

   Set **Git Deployment Type** to **Automatic**, which also needs **Create Deployments**. With **Manual**, you start each deployment with **Deploy**.

   _Screenshot: The Git Deployment Type setting, set to Automatic._

A push to the repository's branch starts a deployment.

## If pushes do not deploy

| The row says                                                     | What to do                                                                               |
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| The connected user does not have admin access to the repository  | Give the account admin access, then remove the repository and add it again.              |
| **Pushes to this repository are not reaching the Control Panel** | The webhook could not be added: follow the reason beside it.                             |
| **Grant organisation access**                                    | Follow the link to let the connection read the repositories of your GitHub organisation. |
| **Reconnect**                                                    | Follow the link and sign in to the Git account again.                                    |

## Remove a repository

1. **Remove the row**

   Choose the **×** button at the end of the row.

Pushes to that repository no longer deploy to this environment.

## Automate this

**API:** [Create an environment's repository](https://docs.corefinity.com/api/reference/enterprise/create-environment-repository.md), scope `write`

```bash
curl -X POST https://manage.corefinity.com/api/environments/1311/repositories \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "branch": "main",
    "connection_id": 4216,
    "pipeline_id": 2210,
    "repo": "northwind-digital/harbourandfinch-trade-theme",
    "root_directory": "/"
  }'
```

**MCP:** [`corestack_enterprise_repository_set`](https://docs.corefinity.com/mcp/tools/corestack_enterprise_repository_set.md), scope `write`

```json
{
  "name": "corestack_enterprise_repository_set",
  "arguments": {
    "enterprise_env_id": 1530,
    "connection_id": 412,
    "pipeline_id": 2210,
    "repo": "example-org/storefront",
    "branch": "main",
    "root_directory": "/"
  }
}
```

**Control Panel:** Managed Websites › your Enterprise website › Deployments

## Related

- [Deployments and pipelines](/guides/corestack-enterprise/deployments-and-pipelines): Deploy a commit and follow it.
- [Repository connections](/guides/organisation/developers/repository-connections): Connect your GitHub, GitLab or Bitbucket account.
- [Connect a repository](/guides/sites/code-and-deployments/connect-a-repository): Switch a site to Git deployments.
