Skip to content
← Back to the blog
appssoftware development

Lovable GitHub sync not working? Causes and fixes

Why commits don't show up in Lovable, what 'diverged' and the lovable-sync branch mean, and how to work with GitHub and Lovable without losing changes.

By Devonauts Team5 min read
Leer en español →
Close-up of a laptop screen showing code in an editor with a file tree on the left

Lovable's GitHub sync usually "stops working" for one of four reasons: the commits went to a branch Lovable isn't syncing, GitHub's push notification never reached Lovable, both sides changed the same branch and diverged, or Lovable lost access to the repository. Each one shows up in the sync status card under Project settings → Git → GitHub, and each has a specific fix. Retrying the same push rarely helps.

Below: how the sync actually works, how to read the status card, a symptom-by-symptom table, how to recover work that a push replaced, and a branch setup that keeps you and a developer from overwriting each other.

How does Lovable's GitHub sync work?

According to Lovable's GitHub integration docs, the sync is two-way but has firm limits:

  • One branch at a time. Lovable edits and syncs a single branch, by default the repository's default branch (usually main). Commits on any other branch don't appear in Lovable until they're merged into that branch.
  • Export only. Connecting a project always creates a new repository. You can't point Lovable at an existing repo through Git sync.
  • One repository per project, on one provider (GitHub, GitLab or Bitbucket).
  • Lovable keeps its own copy of the branch. That's why rewriting history on GitHub causes trouble later.

Renaming the repository or your GitHub account keeps the sync running on GitHub. Deleting the repository stops it.

How do I read the sync status?

Open Project settings → Git → GitHub. The status card compares the latest commits on both sides and shows one of these:

  • Both sides on the same commit: nothing to do. If your change is still missing, it's probably on another branch.
  • GitHub is N commits ahead of Lovable: Lovable hasn't pulled those commits.
  • Lovable and GitHub have diverged: each side has commits the other doesn't.
  • Couldn't check GitHub right now: the comparison failed. Click Re-check to compare again.

The Re-check button only compares again. It doesn't pull or push anything, which surprises a lot of people.

What's causing my problem?

SymptomLikely causeFix
My commits never appear in LovableThey're on a different branchMerge into the synced branch, or switch the synced branch in the branch picker
Status says GitHub is ahead, and it stays that wayLovable never got the push notificationPush a new commit to the synced branch (an empty one works)
Lovable's changes landed on a lovable-sync branchGitHub rejected Lovable's push: branch protection or conflicting commitsReview lovable-sync and merge it through a pull request
A lovable-fallback branch appearedSomeone deleted the synced branch on GitHubSwitch to another branch or recreate the original
Sync stopped after adding mediaA file over GitHub's 100 MB limitRemove the file and let the sync retry
A Reconnect prompt appearsThe Lovable GitHub app was suspended, uninstalled or lost access to the repoFollow the Reconnect steps and restore repository access

How do I fix each one?

Commits on the wrong branch

In the project's GitHub settings, open the branch picker. If it says main and you pushed to feature/login, either open a pull request into main and merge it, or switch Lovable to feature/login. Remember that a new branch created from the picker starts from the currently active branch, not from main.

GitHub is ahead and nothing happens

Lovable pulls when GitHub notifies it of a push. If that notification is lost, the commits stay missing until the next push. Lovable's documented fix is to push again:

git commit --allow-empty -m "Trigger Lovable sync"
git push

Before you do this, make sure your latest Lovable edits are already on GitHub. If the status says the two have diverged, this push replaces Lovable's version of the branch with the GitHub version.

The two sides diverged

This happens when someone edits in Lovable while someone else pushes to the same branch, or when the branch history is rewritten. Lovable puts its own work on lovable-sync instead of overwriting yours. Open that branch on GitHub, compare it with main, and merge it with a merge commit. If later pushes are rejected too, Lovable keeps adding to lovable-sync, or creates lovable-sync-<timestamp> if you've committed to lovable-sync yourself.

Lovable lost access

If an admin changed the GitHub app from "All repositories" to "Only select repositories" and left yours out, click Reconnect and add the repository back under Repository access. If the app was uninstalled entirely, every linked project was disconnected. Reinstalling creates a new connection, and reconnecting a project creates a new repository. Your old repository stays on GitHub, so copy any history you need from it.

Can I get back work that a push replaced?

Usually, yes. When a push from GitHub replaces commits Lovable made, Lovable saves a backup first and shows A repository push replaced your Lovable work. Only the project owner can click Review restore and choose Restore Lovable work. The notice shows for 24 hours. After that, the owner can still find it under Project settings → Git with Check for saved Lovable work.

If you're not the owner, ask them before anyone pushes again.

How should a developer and Lovable share a repository?

Most sync trouble comes from two people editing the same branch at once. A simple setup avoids it:

  1. Keep Lovable on main.
  2. The developer clones the repo and works on a feature branch, never directly on main.
  3. Changes reach main through a pull request, merged with a merge commit.
  4. Nobody force-pushes, rebases or squashes commits that are already on main. To undo something, add a commit that reverts it.
  5. Stop prompting in Lovable while a large merge lands, then check the status card shows both sides on the same commit before you continue.

If your team requires a pull request for every change to main, switch Lovable to its own branch instead, and merge its work the same way. The protected branch will reject Lovable's direct pushes anyway.

When something goes wrong in the code rather than the sync, our guide on undoing changes an AI agent made covers checkpoints and git revert. If you're preparing the repository for someone else, see handing an AI-built project to a developer.

Quick answers

Why don't my GitHub changes show in Lovable? Either they're on a branch Lovable isn't syncing, or Lovable missed the push. Check the branch picker first, then push a new commit.

Does Re-check fix the sync? No. It compares the two sides again and shows the result. It never pulls or pushes.

Can I connect Lovable to a repository I already have? Not through Git sync. Lovable always creates a new repository. You can import a ZIP of existing code as a new project instead.

Is it safe to rename my GitHub repository? On GitHub, yes: the sync follows a rename. Deleting the repository is what breaks it.

Need a hand untangling it?

If branches have multiplied and nobody is sure which version is real, it's worth having someone sort it out once. Start with the free health check, read how we fix Lovable apps, or send us the details.

Still stuck with your app?

Run the free health check on your app's URL, or get the $299 App Rescue Audit: a senior engineer reviews the code and sends you a written report in 2 business days.