The short version
- Connect GitHub in Lovable. Open Project settings → Git → GitHub, or the + next to the chat box, then Project → GitHub, and click Connect. Lovable creates a new repository in your GitHub account and starts syncing both ways. The repository is private by default, and GitHub sync on github.com is available on every Lovable plan (Lovable docs).
- Install Claude Code. It comes in the Claude desktop app, in the Code tab, and it needs a paid Claude plan: Pro, Max, Team or Enterprise (Claude Code docs). Codex, OpenAI’s agent, works the same way on the same repository.
- Let the agent work on the repository. It copies the repository to your computer, makes the change, and pushes it. Commits pushed to the synced branch appear back in your Lovable project (Lovable docs).
- Click Publish in Lovable. A push updates the project inside Lovable, not your live site. Lovable’s own answer to “Does pushing to my repository update my live site?” is “No … it never publishes” (Lovable docs). Publish → Publish changes puts it live, and the Publish button is free, while asking Lovable’s chat to publish costs credits (Lovable docs).
That is the whole move for most people. Your code sits in an account you own, your agent builds, and Lovable keeps doing the hosting, the database, the logins and the files.
Three rules that keep the sync working
- One branch. Lovable edits and syncs one branch at a time, usually
main. Commits on other branches do not appear in Lovable until you merge them into it (Lovable docs). - Never rewrite history. Lovable’s docs say not to force-push, rebase or squash commits that are already on the synced branch: “edits made only in Lovable can be lost”. To undo a change, add a commit that reverts it. When both sides have changes the other lacks, Lovable pushes its own work to a branch called
lovable-syncfor you to merge (Lovable docs). - Keep the repository where it is. Disconnecting keeps your repository on GitHub, but reconnecting makes Lovable create a new one (Lovable docs). Do not disconnect and reconnect to “fix” a sync problem.
What the copy on your computer does not have
- It talks to your real data. In a Lovable Cloud project, the repository’s
.envfile points at your Cloud backend, so “records you create or delete locally change real data” (Lovable docs). Test with test accounts. - Secrets and Lovable’s AI stay in Lovable. Secrets you stored in Lovable are not in the repository, and the credentials behind Lovable AI and its connectors cannot be copied out. In apps created from 13 May 2026 the server code runs on your machine when you test locally, so those calls fail there; test them in Lovable’s preview or on your live app (Lovable docs).
- Server code does not deploy itself. Edge functions and database changes your agent writes reach Lovable as files, and Lovable does not deploy them when the commit syncs. See edge functions not deployed after a push.
What it costs
- GitHub: the sync is available on every Lovable plan (Lovable docs).
- Claude Code: a paid Claude plan (Claude Code docs).
- Lovable, still: hosting your app and running its database use Lovable’s run credits, which you can see under More → Cloud → Usage (Lovable docs), and every message to Lovable’s chat uses credits (Lovable docs). Editing code yourself in Lovable’s code editor does not (Lovable docs).
What changes is who does the building. People who work this way describe the saving in their own numbers: “If I had done all of that in Lovable, I estimate it would’ve cost $500-800 in tokens” (r/lovable, December 2025), and “Use Codex or Claude Code for precise edits … Go back to Lovable mainly to publish. This saved me way more credits than trying to write ‘better prompts’” (r/lovable, June 2026). Those are their results, not a promise about yours.
Do you need to leave Lovable for this?
No. This is stage 2 of six, and it moves nothing your users depend on. Move the hosting or the data only when something in your business asks for it. If you are weighing the two tools against each other, see Lovable vs Claude Code.
Where this fits
This is part of stage 2, bring in your agent. Other short answers: