GitHub

Connect GitHub repositories as Rebase source backing and GitOps primitives.

GitHub is the source-backing integration for Rebase Platform. It lets a workspace or project point at a GitHub repository so deployed Rebase functions, workflows, ASGI apps, and models can be tied back to committed source.

The integration is the primitive for Rebase GitOps: Rebase records the repository, path, commit, branch, and dirty state needed to reason about what source produced an immutable version.

What It Provides

CapabilityBehavior
GitHub App installationRebase uses a GitHub App installation instead of user personal access tokens.
Repository connectionA workspace or one project can be connected to a specific repository and optional path.
Source backingConnected repositories enable workspace_repo and project_repo source modes.
Deploy provenanceGitHub-backed deploys require a clean committed source file and store the commit metadata on the immutable Rebase version.
Protected deploysGitOps-protected environments create deployment requests from committed Git source instead of direct local deploys.
Starter workflowRebase can create a starter workflow file in the connected repository through the GitHub App.

Setup

Run the GitHub connection wizard after rebase setup has saved a workspace profile:

rebase connect github --repo rebase-energy/platform-workflows --repo-scope workspace

For a new workspace, create the workspace first:

rebase workspace create energy-team
rebase connect github --repo rebase-energy/platform-workflows

The connection wizard asks whether the repository should be connected at workspace or project scope, then opens the Rebase GitHub App installation page. Choose Only select repositories in GitHub and select the repository Rebase should use.

If the repository does not exist yet, pass --create-repo to open GitHub's new-repository page before installing the app:

rebase connect github --create-repo

Repository Scopes

GitHub connections can be scoped in two ways:

ScopeUse it whenSource mode
WorkspaceOne repository backs the workspace, and projects map to folders inside it.workspace_repo
ProjectEach project can use its own repository.project_repo

For a workspace repository layout, configure the workspace once and give each project a path:

import rebase as rb

rb.update_workspace(
    source_mode="workspace_repo",
    repo_owner="rebase-energy",
    repo_name="platform-workflows",
)

project = rb.project(
    "energy-forecasting",
    source_mode="workspace_repo",
    repo_path="projects/energy-forecasting",
)

GitHub-Backed Deploys

Rebase-hosted source remains the default. To deploy from GitHub-backed source, opt in with deploy_source="github" or the CLI --source github flag:

project.deploy(deploy_source="github")
rebase deploy workflow.py --source github

GitHub-backed deploys require:

RequirementWhy it matters
Connected repositoryThe workspace or project must already have a GitHub repo connection.
Source file inside the repoRebase stores the source path relative to the repository root.
Clean committed fileRebase records a commit SHA and rejects dirty GitHub-backed deploys.
Matching repo metadataSubmitted repo_owner, repo_name, and repo_path must match the configured connection.

Rebase still creates immutable versions for deployed targets. GitHub provides source provenance and a GitOps anchor; Rebase stores the version record, execution metadata, run history, and endpoint linkage.

GitOps-Protected Deploys

Environment policies use the GitHub connection for GitOps rigor. New workspaces default to direct deploys for dev and GitOps-protected deploys for staging and prod.

rebase environment list
rebase deploy deploy.py --env prod

For a protected environment, rebase deploy checks that the deploy file is in the connected GitHub repository, requires the file to be clean and committed, creates a GitOps deployment request, and returns a GitHub PR or compare URL for review.

rebase deploy deploy.py --env prod --plan

Use --plan to inspect the source repo, source path, branch, and commit Rebase would use without creating the request.

Manage policies with:

rebase environment protect prod --allowed-branch main
rebase environment unprotect dev

See GitOps Deployments for the deployment-mode model.

API Flow

The connection wizard uses the GitHub integration API behind the scenes:

StepAPI behavior
Create setup sessionRebase creates a pending setup session and returns a GitHub App installation URL with a state token.
Install appGitHub redirects back to Rebase with the state and installation ID.
Record installationRebase stores the GitHub App installation account and marks the setup session installed.
Connect repoRebase verifies that the repository is accessible to the installation, then stores a workspace or project repo connection.
Apply source modeWorkspace connections update the workspace to workspace_repo; project connections update that project to project_repo.

The same API can list repositories visible to an installation, find the installation for a repository, list active repo connections, connect a repository, and create a starter workflow file.

Reference

See rebase connect, rebase workspace create, rebase.update_workspace, and rebase.Project for the user-facing commands and SDK parameters.

On this page