Reconnect a GitHub repository

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

Reconnects the app to the GitHub repository it was disconnected from.

Only the app's owner can reconnect, and the workspace plan has to include the GitHub integration. There's something to reconnect only after a user disconnected the app, so check previous_repository in Get GitHub connection first.

Base44 compares the app's history with the repository's default branch and brings whichever side is behind up to date:

  • When they match, nothing moves.
  • When the app has newer commits, Base44 pushes them to the repository.
  • When the repository has newer commits, Base44 pulls them into the app.

When both sides have new commits, or their histories are unrelated, the reconnect is refused and the app stays disconnected. A successful reconnect also turns automatic sync back on and copies the app's open branches to the repository.

Reinstalling the webhook that tells Base44 about new commits can fail without failing the reconnect, so check webhook_active in Get GitHub connection afterwards. Check the same call before you retry a reconnect whose response you lost. One that already succeeded answers a retry with no_previous_repository.

A refused reconnect leaves the app disconnected, and its body is {"error": {"code", "message", "details"}}. Branch on code, whose values are listed with each error response.

A pull that fails after the reconnect is reported in sync rather than as an error. The repository is connected by then, so retry the pull with Pull changes from GitHub.

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time.</Warning>

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

Path parameters

app_idstring required

ID of the app to reconnect to the GitHub repository it was disconnected from.

ID of the app to reconnect to the GitHub repository it was disconnected from.

Response

The app is connected to its repository again.

direction'none' | 'base44_to_github' | 'github_to_base44' required

Which side Base44 brought up to date. Either none (the two already matched), base44_to_github (Base44 pushed the app's newer commits), or github_to_base44 (Base44 pulled the repository's newer commits).

repo_full_namestring required

Full repository name, as owner/repo.

repo_urlstring required

URL of the repository on GitHub.

base44_headstring required

The app's latest commit when the reconnect started.

github_headstring required

Head of the repository's default branch when the reconnect started.

Example response

{
  "direction": "base44_to_github",
  "repo_full_name": "base44/lead-tracker",
  "repo_url": "https://github.com/base44/lead-tracker",
  "base44_head": "4c7e1f90ab3d5628e1a0f7b24c9d8e6350a1b2c4",
  "github_head": "9f2c1ab7d4e58036bb1f4c0a7de92b41c0d5e8a3",
  "sync": {
    "synced": true,
    "commits_pulled": 2,
    "latest_commit_hash": "4c7e1f90ab3d5628e1a0f7b24c9d8e6350a1b2c4",
    "commits": [
      {
        "author_email": "dana@example.com",
        "author_name": "Dana Levi",
        "message": "Fix the lead scoring rounding",
        "sha": "4c7e1f90ab3d5628e1a0f7b24c9d8e6350a1b2c4",
        "short_sha": "4c7e1f9",
        "timestamp": "2026-08-15T09:08:41+00:00",
        "url": "https://github.com/base44/lead-tracker/commit/4c7e1f90ab3d5628e1a0f7b24c9d8e6350a1b2c4"
      }
    ],
    "files_summary": {
      "total_files": 7,
      "files_with_content": 6,
      "files_metadata_only": 1,
      "files_deleted": 1,
      "total_additions": 214,
      "total_deletions": 31
    },
    "error": "merge_conflict",
    "error_message": "Merge conflict while applying the pulled commits",
    "duration_ms": 4120
  }
}

Changes

Changed in 1 of the 18 revisions of this API.1

Of the 18 revisions, 1 has no diff computed.