Skip to content
VibecodeZero

Save Lovable credits: edit your code on GitHub with Claude Code or Cursor, keep Lovable for the backend

Updated

This guide is for you if your Lovable credits run out fast and you’ve heard the tip: sync your project to GitHub, make code changes in another tool, like Cursor or Claude Code, and come back to Lovable. It explains what Lovable’s docs actually say about credits in that setup, the steps, and what can break. It assumes you, or someone helping you, are comfortable opening a code editor. It’s not about leaving Lovable.

The facts about Lovable come from its docs on GitHub sync, the Git sync overview and credits and usage, and the facts about Claude Code from its costs page, all checked October 29, 2026. We don’t quote prices for Claude Code or Cursor here: their plan pages change often, so we link to our guides about them instead. Menus change, so check those pages if something looks different. The Lovable button at the end of this page is an affiliate link: if you sign up through it, we may earn a commission, at no extra cost to you. The links to the docs are plain links. See how we make money.

How the flow works: Lovable, GitHub and your editor

Lovable’s Git sync connects your project to a repository on GitHub and keeps the two in sync both ways:

  • Lovable → GitHub. Lovable commits the edits you make in Lovable and pushes them to your repository.
  • GitHub → Lovable. Commits you push to the synced branch, usually main, appear back in your Lovable project.
  • Your editor. You clone the repository to your computer, change the code in Cursor, Claude Code or any other editor or assistant that works with Git, and push the result. Lovable’s docs say it receives the commits regardless of which tool made them.

On credits, Lovable’s docs answer the question directly:

“You use no Lovable credits when you edit and commit code on your computer. A change you ask Lovable to make in the project chat consumes credits as usual. Calls your local app makes to your Cloud backend or through the AI Gateway count as Cloud and AI usage, the same as calls from your published app. External services bill you directly for the calls your app makes to them.”

So the saving is on build credits: the ones Plan mode and Build mode messages in the project chat use. It doesn’t cover your app’s own Cloud and AI usage, and it moves the work to another tool with its own limits.

Before you start: what sync does and doesn’t include

  • Available on all plans. Lovable’s docs say GitHub sync on github.com works on every plan. You need a GitHub account, which is free at github.com.
  • Always a new repository. Lovable creates a new repository when you connect, private by default. You can’t connect a repository you already have.
  • One branch at a time. Lovable edits and syncs one branch, usually main. Commits on other branches don’t appear in Lovable until you merge them.
  • No database data. The repository holds your code, including the migration files that describe your database structure, but never the data inside the database.
  • No secrets. Secrets you store in Lovable stay out of the repository.
  • Not the same as downloading. Downloading your code with Download codebase is for paid plans. Git sync is the ongoing two-way connection.

Step by step

1. Connect the project to GitHub

  1. In your Lovable project, open Project settings → Git → GitHub. You can also get there from the + button next to the chat box, under Project → GitHub.
  2. If your workspace isn’t connected to GitHub yet, a workspace owner or admin clicks Add connection, then Add account. In the GitHub window, choose your account, choose All repositories or Only select repositories, and click Install & Authorize.
  3. Click Connect next to your GitHub account. Lovable creates the repository and starts syncing.

Don’t delete that repository later: Lovable’s docs say deleting it stops the sync.

2. Open it in Cursor or Claude Code, on a branch

Before you clone, let any Lovable edit in progress finish, then check the sync status card in Project settings → Git. When it says In sync with GitHub, your copy starts from Lovable’s latest changes.

Copy the HTTPS clone URL from the same settings and clone the repository, from your editor or a terminal:

git clone <the URL you copied>

Make a separate branch for your work. Lovable’s docs recommend keeping Lovable on the synced branch, usually main, and making your own changes on a feature branch. Your branch stays out of the Lovable project until you merge it:

git switch -c my-changes

Open the folder in Cursor or Claude Code and make your changes. To run the app locally, Lovable’s docs say to check the repository’s README and package.json for what to install and which commands start the app.

Careful with real data. The repository’s .env file carries your backend’s address and public key, like VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY. Lovable’s docs say a local app with that configuration “reads and writes the same backend as your published app, so records you create or delete locally change real data.” A Git branch doesn’t give you a separate database. Use test accounts.

3. Push, merge and check it reached Lovable

When a change is ready, commit it and push your branch:

git add -A
git commit -m "Describe the change"
git push -u origin my-changes

Then merge it into the synced branch. On GitHub, open a pull request from your branch into main and merge it, as Lovable’s docs suggest. Lovable pulls the result, and the sync status card shows In sync with GitHub again.

If the change doesn’t show up in Lovable:

  • You pushed to a different branch. Only the synced branch appears in Lovable. Merge into it, or switch the synced branch in Lovable’s GitHub settings.
  • The card says “GitHub is N commits ahead of Lovable”. Lovable’s docs say Lovable missed the notice about your push. Push any new commit to the synced branch, even an empty one, and Lovable syncs the branch to its current state.

Then tell Lovable what changed, so its next edit builds on your work. Lovable’s docs suggest this message. It’s a normal chat request, so it uses credits:

I changed [files] outside Lovable to [describe the change]. Keep [behavior or constraint] when making further edits. Now [describe the next change you want].

4. Go back to Lovable for the backend, database and publishing

Some things don’t happen just because your commit synced. Lovable’s docs say:

  • Backend functions. Lovable doesn’t deploy a changed Edge Function (the backend code under supabase/functions/) when your commits sync. After the commit syncs, ask Lovable in the project chat to deploy the function, then check it under More → Database → Manage → Edge functions.
  • Database structure. Lovable doesn’t run a new migration file that arrives through Git. To change the database structure, ask Lovable in the project chat, or run the SQL yourself in the SQL editor.
  • Publishing. Pushing or merging never publishes. Your live site only changes when you publish from Lovable.

These are Lovable chat requests, so they use credits. That’s the trade: code edits move to your editor, while the backend, the database and publishing stay in Lovable.

What can break

  • Editing on both sides at once. If Lovable and GitHub each get commits the other doesn’t have, the sync status says Lovable and GitHub have diverged. Lovable’s docs say it then pushes its changes to a separate lovable-sync branch, and the next sync from GitHub replaces Lovable’s version of the branch. Let Lovable finish before you merge, and avoid asking Lovable for changes while your branch is open on the same files.
  • Rewriting the synced branch. Don’t force-push, rebase or squash commits already on the synced branch. Lovable’s docs say the next sync then saves a backup of Lovable’s copy and replaces it with yours. The notice A repository push replaced your Lovable work appears for 24 hours, and only the project owner can click Review restore (after that, Check for saved Lovable work in Project settings → Git). To undo a change, add a new commit that reverts it.
  • Backend and database changes made outside. As in step 4, a changed Edge Function or a new migration that arrives through GitHub isn’t applied until you ask Lovable.
  • Secrets. Secrets stored in Lovable stay out of the repository, so server code that reads them needs those values wherever it runs. And variables that start with VITE_ go into the code sent to the browser: Lovable’s docs say never to put a service role key or any other secret in them.
  • Newer Lovable apps. In apps created from May 13, 2026, which use TanStack Start, Lovable’s docs say the server code runs on your computer when you run the app locally, so connector and Lovable AI calls fail there. Test those in the Lovable preview or in your published app.
  • Lovable editing your code later. Lovable’s docs say it treats code you wrote like code it generated, and can change it in a later request. Write the rules that must hold in your project instructions, and keep tests for behavior you depend on.

If your app has already piled up quick fixes, Technical debt in a Lovable app shows how to spot it before you start editing by hand.

Is it worth it? Lovable credits vs Claude Code or Cursor limits

This flow doesn’t make the work free. It moves code edits from Lovable credits to another tool’s limits, and how much you save depends on your project and your requests. We can’t put a number on it.

Our take: it tends to pay off when most of your next changes are code-only, like layout, text or app logic, and you’re comfortable reviewing what the editor changed. If most of your changes touch the database, backend functions or publishing, you’ll still need Lovable’s chat for them. To compare the monthly cost of the tools side by side, try the cost calculator. And if what you’re really after is running your own backend, see How to move from Lovable Cloud to your own Supabase project.

Questions people ask

Does editing my Lovable project in Cursor or Claude Code use Lovable credits?

No, according to Lovable's Git sync docs: "You use no Lovable credits when you edit and commit code on your computer." What still uses Lovable credits is anything you ask Lovable to do in the project chat. Calls your app makes to Lovable Cloud or through the AI Gateway count as Cloud and AI usage, the same as calls from your published app. And Cursor or Claude Code uses its own plan's limits.

Do I need a paid Lovable plan to sync with GitHub?

No. Lovable's docs say GitHub sync on github.com is available on all plans. Downloading your code as a file is different: the Download codebase option is for paid plans. Git sync is for ongoing two-way sync.

Can I connect a GitHub repository I already have?

No. Lovable's docs say Git sync only exports from Lovable: when you connect a project, Lovable always creates a new repository. The repository is private by default.

Do I have to use Cursor or Claude Code?

No. Lovable's docs say it receives the commits you push to the synced branch regardless of which tool made them, so any editor or coding assistant that works with Git is fine.

Will Lovable keep the code I changed outside Lovable?

Your changes become part of the project when they sync, and Lovable builds on them. But Lovable's docs say it can also change that code in a later request, the same as code it generated. To protect behavior you depend on, describe it in your project instructions and keep tests for it.

What happens if I edit in Lovable and in my editor at the same time?

The two sides can diverge. Lovable's docs say that when Lovable and GitHub each have commits the other doesn't, Lovable pushes its changes to a separate lovable-sync branch, and the next sync from GitHub replaces Lovable's version of the branch. Lovable saves a backup first, and the project owner can restore it: from the notice in the editor, which Lovable shows for 24 hours, or later with Check for saved Lovable work in Project settings → Git.

Is my database in the GitHub repository?

No. Lovable's docs say the repository has your code, including the files that describe your database structure, but never the data inside your database. If you run the app on your computer with the repository's settings, it reads and writes the same backend as your published app, so use test accounts.

New guides by email. An email when we publish a new guide, error fix or chapter, in plain English. Subscribe