docs/ai_builder/features/connect_to_github.md
import reflex as rx
Connecting your app to GitHub gives it a version history and lets you edit the code locally. Each sync is a commit in an ordinary Git repository.
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/connecting_to_github.avif",
alt="Connecting a Reflex AI Builder app to GitHub",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
)
The GitHub integration allows you to:
Reflex Build connects to GitHub through the reflex-build GitHub App using OAuth. The first time you connect, GitHub prompts you to install the app and authorize access. It then links your GitHub account to Reflex Build, which stores an encrypted access token and uses it to create repositories and push commits for you.
Pushes, pulls, and reverts use short-lived GitHub App installation tokens that Reflex Build requests as needed. Your personal OAuth token identifies you and refreshes access. Both are encrypted at rest.
Each user connects their own GitHub account. Connections are stored per user; there is no shared or organization-level token. If one teammate connects GitHub, another teammate who wants to push or pull has to run the same connect flow and authorize the reflex-build app with their own account.
Commits are attributed to the GitHub user who made them, and each person's access to a repository follows their own GitHub permissions.
The GitHub App installation is separate from per-user authorization. An organization owner can install the reflex-build app once and choose which repositories it may access, which controls what is reachable from Reflex Build. Each user still authorizes the app once to link their own account before they can push or pull.
When you connect a Build app to GitHub, Reflex Build creates a Git repository for it:
reflex-build app is installed on a GitHub organization, the repository is created inside that organization.New repositories use the main branch and are private, unless you make them public when connecting.
The GitHub popover in the editor syncs in both directions:
You can also clone the repository, edit it locally, and push your changes back.
The commit history is a great way to see the changes that you have made to your app. You can also revert to previous versions of your app from here.
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/github_commit_history.avif",
alt="GitHub commit history for a Reflex AI Builder app",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
)
Reverting resets your app's files to an earlier commit.
To connect a repository hosted somewhere other than GitHub, such as GitLab, Bitbucket, or a self-hosted Git server, use the generic Git connection instead. See Connecting to Git Providers for details.
Git integration is available on plans that include the Git connection feature. If your plan does not include it, connecting will prompt you to upgrade.