---
title: "Connect a GitHub repository"
method: POST
path: "/api/apps/{app_id}/github/connect"
---

# Connect a GitHub repository

`POST /api/apps/{app_id}/github/connect`

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Creates a new private GitHub repository and connects the app to it.

Only the app's owner can connect a repository, and the workspace plan has to include the GitHub integration. An app that already has a connection can't connect again, and this API can't disconnect one. You do that in the Base44 online app editor.

The call creates the repository, installs the webhook that tells Base44 about new commits, and pushes the app's current code as the first commit. The response comes back only after all of that finishes. The webhook is the one step that can fail without failing the connection, so check `webhook_active` in [Get GitHub connection](/api-reference/get-github-connection) afterwards.

If any of the rest fails, Base44 undoes the connection but leaves the repository it already created on GitHub. Delete that repository or send a different `repo_name` before you retry. Check [Get GitHub connection](/api-reference/get-github-connection) first, because a failure late in the call can leave the connection in place.

From then on the repository is where the app's code lives. Base44 pushes each change to it, and you bring work done in GitHub back with [Pull changes from GitHub](/api-reference/pull-changes-from-github).

## Path parameters

- `app_id` string, required — ID of the app to connect to a GitHub repository.

## Request body

- ConnectRepoRequest — Request to connect a repository.
  - `org_name` string, required — GitHub username or organization to create the repository under, as returned in `login` by [List GitHub organizations](/api-reference/list-github-organizations).
  - `repo_name` string, required — Name for the new repository. 1 to 100 characters made of letters, digits, hyphens, underscores or periods, starting and ending with a letter or digit, and it must not already exist on the account.
  - `installation_id` string, required — ID of the Base44 GitHub App installation on that account, as returned in `installation_id` by [List GitHub organizations](/api-reference/list-github-organizations).
  - `description` string, nullable — Description for the new repository. Defaults to the app's name.

## Response `200`

The repository that was created and connected.

- RepositoryConnectionResponse — Result of connecting a repository.
  - `connection_id` string, required — ID of the connection Base44 stored for this app.
  - `repo_url` string, required — URL of the repository on GitHub.
  - `repo_full_name` string, required — Full repository name, as `owner/repo`.
  - `clone_urls` CloneUrls, required — Repository clone URLs in different formats.
    - `https` string, required — URL to clone the repository over HTTPS.
    - `ssh` string, required — URL to clone the repository over SSH.
    - `gh_cli` string, required — Ready-to-run GitHub CLI clone command.
  - `default_branch` string, required — Default branch of the new repository. Base44 pushes the app's code to this branch.

## Other responses

- `400` — The `repo_name` is invalid, the repository already exists, the app is already connected, your GitHub account isn't connected to Base44, the `installation_id` isn't one you can use on that account, or the GitHub App on this account covers selected repositories only.
- `401` — Missing or invalid credentials.
- `402` — Your workspace plan doesn't include the GitHub integration.
- `403` — You aren't the app's owner, the app's workspace doesn't approve this GitHub organization, or you used a workspace API key.
- `404` — App not found.
- `409` — The app is busy with another operation. Wait for it to finish and try again.
- `422` — The request body is missing a required field, or one of its values has the wrong type.

## Changes

- **2026-09-02** `6ad855bf424f` — 1 breaking
  - removed the media type `application/json` for the response with the status `422`

[Change history](https://skmtc.dev/adexad/apis/base44-app-management-api/changes/api/apps/:app_id/github/connect/post.md)

---

[API](https://skmtc.dev/adexad/apis/base44-app-management-api.md) · [All operations](https://skmtc.dev/adexad/apis/base44-app-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/adexad/base44-app-management-api/revisions/6ad855bf424f/schema)
