Connect a GitHub repository

<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 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 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.

post/api/apps/{app_id}/github/connect

Path parameters

app_idstring required

ID of the app to connect to a GitHub repository.

ID of the app to connect to a GitHub repository.

Request body

org_namestring required

GitHub username or organization to create the repository under, as returned in login by List GitHub organizations.

repo_namestring 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_idstring required

ID of the Base44 GitHub App installation on that account, as returned in installation_id by List GitHub organizations.

descriptionstring nullable

Description for the new repository. Defaults to the app's name.

Example request

{
  "org_name": "base44",
  "repo_name": "lead-tracker",
  "installation_id": "58231904",
  "description": "Sales lead tracker"
}

Response

The repository that was created and connected.

connection_idstring required

ID of the connection Base44 stored for this app.

repo_urlstring required

URL of the repository on GitHub.

repo_full_namestring required

Full repository name, as owner/repo.

default_branchstring required

Default branch of the new repository. Base44 pushes the app's code to this branch.

Example response

{
  "connection_id": "6890b1c4f2a7e3105d8a4472",
  "repo_url": "https://github.com/base44/lead-tracker",
  "repo_full_name": "base44/lead-tracker",
  "clone_urls": {
    "https": "https://github.com/base44/lead-tracker.git",
    "ssh": "git@github.com:base44/lead-tracker.git",
    "gh_cli": "gh repo clone base44/lead-tracker"
  },
  "default_branch": "main"
}

Changes