# Organization API: Organization deployments: Git

> The 4 Organization API operations for git.

Source: https://www.coritan.com/docs/api/reference/organizations/organization-deployments/deployments-git/

Part of [Organization deployments](/docs/api/reference/organizations/organization-deployments/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`](#op-get-api-v1-orgs-org-slug-deployments-deployment-uuid-git) | Get the repository connection |
| PUT | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`](#op-put-api-v1-orgs-org-slug-deployments-deployment-uuid-git) | Build the deployment from a repository one of the owner's GitHub App installations reaches |
| PATCH | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`](#op-patch-api-v1-orgs-org-slug-deployments-deployment-uuid-git) | Change the repository settings |
| DELETE | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`](#op-delete-api-v1-orgs-org-slug-deployments-deployment-uuid-git) | Stop cloning through the GitHub App |

### Get the repository connection {#op-get-api-v1-orgs-org-slug-deployments-deployment-uuid-git}

`GET /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`

The deployment's repository, its branch and directory, and whether it
is reached through the GitHub App (``connected``) or as a pasted address.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Build the deployment from a repository one of the owner's GitHub App installations reaches {#op-put-api-v1-orgs-org-slug-deployments-deployment-uuid-git}

`PUT /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`

Build the deployment from a repository one of the owner's GitHub App
installations reaches. Its pasted token, if it had one, is deleted: the
App clones from now on. 404 for another owner's installation, 409 while
it is suspended, 422 when it cannot reach the repository. The next
release builds from it.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `installation` | integer | yes | The installation's id here (GET /git/github/installations) |
| `repo_id` | integer | yes | GitHub's id of the repository |
| `branch` | string or null | no | The production branch; the repository's default when left out |
| `root_dir` | string or null | no | The app's directory in the repository |
| `dockerfile_path` | string or null | no | Refused with 422 dockerfile_unsupported when set: Dockerfiles are not built on the platform |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Change the repository settings {#op-patch-api-v1-orgs-org-slug-deployments-deployment-uuid-git}

`PATCH /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`

Change the branch that deploys to production, the app's directory,
previews, pull request comments, watch paths or the ignore command.
Only what the body names changes; null clears ``root_dir``,
``watch_paths`` and ``ignore_command``. Turning ``previews`` on answers
402 when the plan of the account the deployment bills to does not
include them (an organization's owner now, as for a push); turning it
off leaves the live previews serving until they are closed.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `branch` | string or null | no |  |
| `root_dir` | string or null | no | null for the repository's root |
| `previews` | boolean or null | no | Make a preview of each push to another branch and each pull request |
| `pr_comments` | boolean or null | no | Comment each pull request's preview addresses on it |
| `watch_paths` | array of string or null | no | null or [] builds every push |
| `ignore_command` | string or null | no | null for none |
| `dockerfile_path` | string or null | no | Refused with 422 dockerfile_unsupported when set: Dockerfiles are not built on the platform |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Stop cloning through the GitHub App {#op-delete-api-v1-orgs-org-slug-deployments-deployment-uuid-git}

`DELETE /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/git`

Stop cloning through the GitHub App. The deployment keeps its
repository address and builds as a pasted repository would, which
needs a token for a private one.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
