Vibe coding with GitHub means connecting your AI app builder to a GitHub repository, so every change is saved with a full history you control. It's the easiest way to back up your project, undo mistakes, and take your code to another tool or developer later.
Why use GitHub for vibe coding
- Backup. If something goes wrong on the platform, your code is still yours.
- History. Every change is a commit you can look at or go back to.
- Portability. You can open the code in an editor like Cursor or Claude Code, or host it somewhere else.
How each platform connects
Lovable
Lovable's GitHub docs say a workspace admin installs the Lovable GitHub app, then you click Connect on a project. Key points:
- Lovable creates a new repository. It can't link a project to an existing repo; to start from one, import it as a ZIP first.
- New repos are private by default on every plan.
- Sync goes both ways: changes in Lovable go to GitHub, and commits pushed to the active branch come back.
- It syncs the default branch, usually
main, unless you pick another. - Don't delete the repo, because that breaks sync. GitHub also rejects files over 100 MB.
Bolt
Bolt's Git docs say you click the GitHub icon in a project, authorize Bolt and install its GitHub app. Bolt can create a new repo (private by default) or import an existing one from the homepage. It commits automatically after each change that doesn't break the project and checks GitHub every 30 seconds for outside changes. You can create and switch branches, but Bolt can't merge them, so you merge with a pull request on GitHub. One warning: disconnecting a project from its repo is permanent unless you contact support.
v0
v0's GitHub docs say you connect from project settings, and v0 creates a private repo that becomes the source of truth for your code. Each chat works on its own branch with its own preview deployment. When you publish, v0 creates or reuses a pull request, merges it into the base branch and waits for production. You can also import an existing repo.
Replit
Replit's version control docs describe a Git pane under Tools for commits, branches and diffs without the command line. You can connect a project to GitHub and sync with one click, or import a GitHub repo to start a new Replit App.
Keep secrets out of your repo
A repo is the worst place for a secret key, because Git keeps history. Deleting a key in a later commit doesn't remove it from earlier ones.
- Use a
.gitignore. GitHub's docs explain that it tells Git which files to skip. Put.envfiles in it. Next.js's default template already ignores.envfiles, per its environment variable docs. - Untrack files that are already committed. GitHub notes that a new ignore rule doesn't stop Git tracking a file it already tracks. You have to untrack it with
git rm --cachedfirst. - Rotate any key that was committed. If a secret ever reached a commit, treat it as leaked and create a new one. Stripe's key docs say not to put keys in files checked into version control, and Supabase's key docs say to rotate a leaked key once the cause is fixed.
- Know what push protection covers. GitHub's push protection blocks pushes that contain secrets. The version tied to your personal account is on by default, but it only covers public repositories. Protection for a repository itself is off by default and has to be turned on.
Integrations help too. Lovable says its Stripe key is stored as a backend secret that never appears in your code or repository, per its Stripe docs.
Keep the repo private
All four platforms above create private repos by default. Leave it that way unless you mean to open-source the project. A public repo shows every file and every past commit to anyone.
A simple workflow
- Connect GitHub as soon as your first version works.
- Keep building in your platform as usual. Commits happen automatically on Lovable, Bolt and v0.
- Before a risky change, create a branch, or note the last good commit.
- If the change goes badly, go back to that commit. How to fix a vibe coded app covers rollbacks.
- When you outgrow the builder, clone the repo and keep going in a code editor.
Editing outside the builder
Lovable gives each connected project HTTPS, SSH and GitHub CLI clone URLs so you can edit in your own editor and push back. Be careful with two-way sync: if you and the AI change the same file at once, you'll get conflicts. Lovable pushes to a lovable-sync branch when versions diverge, and Bolt asks whether to reapply or discard your last change. Work in one place at a time.
Deploying from GitHub
Once your code is on GitHub, many hosts can deploy it on every push. That's the usual route for apps built in Cursor or Claude Code. How to deploy a vibe coded app walks through what to check first.
See how each platform handles code portability in our comparison.