Link an existing GitHub repository

Changed on

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

Connects an app created with the Base44 CLI to the GitHub repository that already holds its code. Base44 adopts the repository as it is, without creating one or pushing code to it.

The repository's default branch must be main, and its base44/config.jsonc must name this app. From then on the repository is where the app's code lives. Entities, agents, and functions you deployed with the CLI are replaced by their versions in the repository.

Before the call can succeed, the app's owner needs:

  • Their GitHub account connected to Base44. This is done once, in Base44.
  • The Base44 GitHub App installed on the repository with write access.

When either is missing, send the user to the link in the error's details, connect_url or install_url, then repeat the same call. A refused call changes nothing. If a response is lost, check Get GitHub connection before retrying, because a repeat after a successful link is refused.

Base44 imports the repository's code in the background after the call returns. Pull changes from GitHub reports the app as already up to date once the import has finished.

post/api/apps/{app_id}/github/link-existing

Request

  • Base URL
    https://app.base44.com
  • URL
    https://app.base44.com/api/apps/{app_id}/github/link-existing
  • Auth
    HTTP bearer

Path parameters

app_idstring required

ID of the app to connect to a GitHub repository.

Request body

repo_full_namestring required

Repository to link, as owner/repo. Its base44/config.jsonc project name must equal the app's name.

Example request

{
  "repo_full_name": "acme/lead-tracker"
}

Response

The connection Base44 stored for the app.

connection_idstring required

ID of the connection Base44 stored for this app.

repo_full_namestring required

Full repository name, as owner/repo.

repo_urlstring required

URL of the repository on GitHub.

default_branchstring required

Branch Base44 syncs with. Always main.

last_synced_commitstring required

Head commit of main the app was linked at.

Example response

{
  "connection_id": "6890b1c4f2a7e3105d8a4472",
  "repo_full_name": "acme/lead-tracker",
  "repo_url": "https://github.com/acme/lead-tracker",
  "default_branch": "main",
  "last_synced_commit": "3f5d19c8cfc920e65313a0c5174e7e052d13bb2c"
}

Changes