> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy from GitHub with the CLI

> Link a GitHub repository to a Square Cloud app with squarecloud app deploy, through the GitHub App or a webhook, and list the deploys each push started.

`squarecloud app deploy` connects an application to GitHub so that a push deploys it. There are two ways to do it:

* **The Square Cloud GitHub App** (`app deploy github link`): install the app on your repository, then link the repository and a branch.
* **A webhook** (`app deploy webhook`): give a GitHub access token and add the URL the CLI prints to your repository's webhooks.

The help center walks through the GitHub side: [connect your GitHub repository](https://help.squarecloud.app/en-us/article/how-to-connect-your-github-repository-and-deploy-automatically-mr6srt/), or set up an [automated deploy with GitHub Actions](https://help.squarecloud.app/en-us/article/workflow-github-actions-automated-deploy-ff34mk/).

`[appID]` and `--app` are optional: see [how the CLI finds your app](/en/cli-reference/quickstart#how-the-cli-finds-your-app).

## `squarecloud app deploy github link`

```bash Usage theme={"system"}
squarecloud app deploy github link <owner/repository> <branch> [--app <appID>]
```

Links a repository and branch through the Square Cloud GitHub App. The app must be installed on the repository through your GitHub account, and your GitHub account needs write access to it.

```bash theme={"system"}
squarecloud app deploy github link octocat/hello-world main
# Links octocat/hello-world, branch main, to the app in the ID= line.
```

```bash Output theme={"system"}
✓ Repository octocat/hello-world (branch main) linked successfully
```

To link another repository or branch, unlink the current one first.

## `squarecloud app deploy github unlink`

```bash Usage theme={"system"}
squarecloud app deploy github unlink [--app <appID>]
```

Removes the GitHub App link from the application.

## `squarecloud app deploy webhook`

```bash Usage theme={"system"}
squarecloud app deploy webhook <githubToken> [--app <appID>]
squarecloud app deploy webhook --remove [--app <appID>]
```

| Flag | Description |
| - | - |
| `--remove` | Removes the configured webhook. No token needed. |

Creates a webhook deploy integration from a GitHub access token (`ghp_...` or `github_pat_...`) and prints the URL to add as a webhook in your repository settings.

```bash theme={"system"}
squarecloud app deploy webhook <githubToken> --app <appID>
```

```bash Output theme={"system"}
✓ Webhook created successfully; add it to your GitHub repository:
  <webhook URL>
```

## `squarecloud app deploy current`

```bash Usage theme={"system"}
squarecloud app deploy current [appID] [--json]
```

Shows the Git integration configured for the application: the linked repository and branch, the webhook URL, or `No Git integration configured for this application`.

```bash Output theme={"system"}
GitHub App: octocat/hello-world (branch main)
```

## `squarecloud app deploy list`

```bash Usage theme={"system"}
squarecloud app deploy list [appID] [--json]
```

Lists the most recent deploys started by Git pushes, one row per commit, with the latest state of each: the first 8 characters of the commit, its date, its state and the branch.

```bash theme={"system"}
squarecloud app deploy list --json
# Prints the raw timelines: one array of events per deploy.
```

## Related

| Command | API | JavaScript SDK | VS Code |
| - | - | - | - |
| `github link` | [`POST .../deploy/github-app`](/en/api-reference/endpoint/apps/deploy/github-app-link) | [`api.apps.deploys.linkGithubApp()`](/en/sdks/js/deploys) | [Link GitHub repository](/en/vscode-extension/features#applications) |
| `github unlink` | [`DELETE .../deploy/github-app`](/en/api-reference/endpoint/apps/deploy/github-app-unlink) | [`api.apps.deploys.unlinkGithubApp()`](/en/sdks/js/deploys) | [Unlink GitHub repository](/en/vscode-extension/features#applications) |
| `webhook` | [`POST .../deploy/webhook`](/en/api-reference/endpoint/apps/deploy/webhooks) | [`api.apps.deploys.setWebhook()`](/en/sdks/js/deploys) | |
| `current` | [`GET .../deployments/current`](/en/api-reference/endpoint/apps/deploy/info) | [`api.apps.deploys.current()`](/en/sdks/js/deploys) | |
| `list` | [`GET .../deployments`](/en/api-reference/endpoint/apps/deploy/list) | [`api.apps.deploys.list()`](/en/sdks/js/deploys) | |
