Skip to main content
Attach an upstream Git repository to a Mesa repository and trigger syncs with syncUpstream. Syncs report their progress through sync.* webhook events and are exposed on the repository’s upstream field. The upstream is per-repository configuration: one Mesa repo points at one upstream URL, with optional stored credentials. The upstream can be GitHub, GitLab, Bitbucket, or any Git server that supports the Git HTTPS smart protocol.

Sync semantics

By default, Mesa’s GitHub sync is conservative, and will only update branches and tags that have not diverged (fast-forward only). Deletions are not synced. This behavior is the same both when pulling upstream changes and when pushing Mesa changes to an upstream. Mesa attempts to sync all branches and tags by default. You can also filter branches and tags for a single sync with glob patterns. If some matching branches and tags cannot be safely updated (non-fast-forward, branch protection rules, etc.), those updates will be skipped without failing the entire sync. Once a sync completes, per-ref sync outcomes are surfaced in the sync’s stats field.

Configure an upstream

Set an upstream when creating the repository, or attach one later with mesa.repos.update(...). The auth payload is write-only — Mesa stores credentials securely and only returns the auth_kind on read. Repository responses include upstream.latest_sync, which is null until the first sync is enqueued.

Auth options

On repos.update(...), omitting a value for upstream auth preserves the stored credential, while passing null/None clears the stored credential:

Trigger a sync

syncUpstream({ direction: "pull" }) fetches branches and tags from the upstream repository and applies any safe updates to the Mesa repository. direction: "push" works the same way in the other direction; branches and tags are fetched from your Mesa repository, and any safe updates are applied to the upstream repo. Omit ref_globs or use { branches: "*", tags: "*" } to sync all supported branches and tags. To sync only selected refs, pass branch and tag glob filters. If you provide ref_globs, include at least one of branches or tags; an omitted namespace matches no refs. Branches and tags are plain names such as main, release/*, or v1.*, not fully-qualified Git refs such as refs/heads/main. This method enqueues a sync job and returns an object containing the id of the queued sync. The work is performed asynchronously. Fetch the repository and read repo.upstream.latest_sync, fetch the sync by id, or list the repository’s upstream sync history to check status.
status transitions through queuedin_progresscompleted or failed. Once a sync completes, a stats field becomes available with per-ref outcomes (updated, unchanged, filtered, or rejected). stats.refs includes only matching source branches and tags. If a sync fails, the error field provides a failure reason.

Subscribe to sync events

Syncs emit four webhook event types over their lifecycle. Subscribe on a webhook target to drive your own workflows without polling.
Pull syncs also cause the repo.push webhook event to fire if upstream changes are received by Mesa. See Webhooks for delivery semantics, signature verification, and the full event payload shape.

Required scopes

REST endpoints

Each SDK method maps to a REST endpoint under the organization root: See the REST API reference for full request and response schemas.