---
title: Update Git Deployment Settings
description: "Updates the git deployment configuration for a git-deployed site: tracked git_branch, the push-to-deploy webhook toggle (enable_push_deploy), whether the deploy script runs after each pull (run_after_deployment), the post-pull deploy_script, a custom…"
url: "https://betterdocs.shahrear.msf.bd/index.php/docs/hell0-boys-docs/hell0-boys/sites/update-git-deployment-settings/"
updated: "2026-08-20"
category: hell0 boys / Sites
---

# Update Git Deployment Settings

PUT`/sites/{uuid}/git`

## Code Samples

```curl

                curl --request PUT \
  --url 'https://app.xcloud.host/api/v1/sites/{uuid}/git' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "git_branch": "main",
    "enable_push_deploy": true,
    "run_after_deployment": true,
    "deploy_script": "composer install --no-dev\nphp artisan migrate --force",
    "git_pull_script": "git pull origin main",
    "restart_services": false,
    "env_file_path": "app"
}'

                const response = await fetch('https://app.xcloud.host/api/v1/sites/{uuid}/git', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "git_branch": "main",
    "enable_push_deploy": true,
    "run_after_deployment": true,
    "deploy_script": "composer install --no-dev\nphp artisan migrate --force",
    "git_pull_script": "git pull origin main",
    "restart_services": false,
    "env_file_path": "app"
})
});

const data = await response.json();
console.log(data);

                import requests

headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
}

payload = {
    "git_branch": "main",
    "enable_push_deploy": true,
    "run_after_deployment": true,
    "deploy_script": "composer install --no-dev\nphp artisan migrate --force",
    "git_pull_script": "git pull origin main",
    "restart_services": false,
    "env_file_path": "app"
}

response = requests.put("https://app.xcloud.host/api/v1/sites/{uuid}/git", headers=headers, json=payload)

print(response.json())

                <?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://app.xcloud.host/api/v1/sites/{uuid}/git',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
  'Authorization: Bearer YOUR_TOKEN',
  'Content-Type: application/json'
  ],
  CURLOPT_POSTFIELDS => '{
    "git_branch": "main",
    "enable_push_deploy": true,
    "run_after_deployment": true,
    "deploy_script": "composer install --no-dev\\nphp artisan migrate --force",
    "git_pull_script": "git pull origin main",
    "restart_services": false,
    "env_file_path": "app"
}',
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;

                using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("PUT"), "https://app.xcloud.host/api/v1/sites/{uuid}/git");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
request.Content = new StringContent(@"{
    ""git_branch"": ""main"",
    ""enable_push_deploy"": true,
    ""run_after_deployment"": true,
    ""deploy_script"": ""composer install --no-dev\nphp artisan migrate --force"",
    ""git_pull_script"": ""git pull origin main"",
    ""restart_services"": false,
    ""env_file_path"": ""app""
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);

                import java.net.URI;
import java.net.http.*;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://app.xcloud.host/api/v1/sites/{uuid}/git"))
    .header("Authorization", "Bearer YOUR_TOKEN")
    .header("Content-Type", "application/json")
    .method("PUT", HttpRequest.BodyPublishers.ofString("""
{
    "git_branch": "main",
    "enable_push_deploy": true,
    "run_after_deployment": true,
    "deploy_script": "composer install --no-dev\\nphp artisan migrate --force",
    "git_pull_script": "git pull origin main",
    "restart_services": false,
    "env_file_path": "app"
}
"""))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

## Response

```json

                {
    "success": true,
    "message": "Operation completed successfully.",
    "data": {
        "repository": "github.com/myorg/my-wp-theme",
        "branch": "main",
        "provider": "github",
        "push_deploy_enabled": true
    }
}

                {
    "success": false,
    "message": "Unauthenticated.",
    "data": null
}

                {
    "success": false,
    "message": "This action is unauthorized. Your token is missing the required scope.",
    "data": null
}

                {
    "success": false,
    "message": "Not found.",
    "data": null
}

                {
    "success": false,
    "message": "An error occurred.",
    "data": null
}
```

Updates the git deployment configuration for a git-deployed site: tracked `git_branch`, the push-to-deploy webhook toggle (`enable_push_deploy`), whether the deploy script runs after each pull (`run_after_deployment`), the post-pull `deploy_script`, a custom `git_pull_script`, an optional `restart_services` flag, and the site-relative `env_file_path`. Changing the branch is validated against the connected provider (or a live SSH check) before saving. Only `git_branch` is required — send it alone to [Switch](https://betterdocs.shahrear.msf.bd/encyclopedia/switch/) branches and deploy without touching the deploy-script settings. Sensitive keys are never returned. Requires the `write:sites` scope and the `site:manage-update` permission.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `uuid` | string (uuid) | **Required** | UUID of the site |

## Request Body

Content type: `application/json` — **required**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `git_branch` | string | **Required** |  |
| `enable_push_deploy` | boolean | Optional | Enable the push-to-deploy webhook. |
| `run_after_deployment` | boolean | Optional | Run the deploy script after each pull. Optional — omit to keep the current setting. |
| `deploy_script` | string | Optional | Optional post-pull deploy script. |
| `git_pull_script` | string | Optional | Custom git-pull script (overrides the default). |
| `restart_services` | boolean | Optional |  |
| `env_file_path` | string | Optional | Site-relative directory for the .env file (no leading/trailing slash). |

```json

                {
    "git_branch": "main",
    "enable_push_deploy": true,
    "run_after_deployment": true,
    "deploy_script": "composer install --no-dev\nphp artisan migrate --force",
    "git_pull_script": "git pull origin main",
    "restart_services": false,
    "env_file_path": "app"
}
```

## Responses

### 200 — Updated git deployment settings (sensitive keys stripped)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |
| `data` | object | Optional |  |
| `data.repository` | string | Optional |  |
| `data.branch` | string | Optional |  |
| `data.provider` | string | Optional | Allowed: github, gitlab, bitbucket, custom |
| `data.push_deploy_enabled` | boolean | Optional |  |

```json

                {
    "success": true,
    "message": "Operation completed successfully.",
    "data": {
        "repository": "github.com/myorg/my-wp-theme",
        "branch": "main",
        "provider": "github",
        "push_deploy_enabled": true
    }
}
```

### 401 — Missing or invalid authentication token

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "Unauthenticated.",
    "data": null
}
```

### 403 — Token lacks the required scope

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "This action is unauthorized. Your token is missing the required scope.",
    "data": null
}
```

### 404 — Resource not found or not accessible to your [Team](https://betterdocs.shahrear.msf.bd/encyclopedia/team/)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "Not found.",
    "data": null
}
```

### 422 — Not a git-deployed site, validation failed, or the branch could not be validated against the repository.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "An error occurred.",
    "data": null
}
```
