Skip to content
>_VibeUnstuck

Lovable GitHub sync not working

Last verified:

The fix

Lovable GitHub sync not working: the sync status card or a Reconnect prompt says why. Fix that, on the branch the picker shows. Do not force-push the synced branch to make the two sides match.

  1. 1

    Read the card and any Reconnect sentence before you push

    Project settings, then Git, then GitHub. Copy the sync status and the branch name in the picker. If the screen says the app is suspended, uninstalled, or missing repository access, do that Reconnect action. Do not disconnect the project to reset a card. Disconnect ends the link, and the next connect creates a new repository. A rename of the repo or the account is not a break. A transfer without a connection for the new owner is. A deleted repository has to be restored, or replaced with a new one.

  2. 2

    Put the commits on the branch the picker shows

    Local commits on a feature branch do not appear in Lovable. Merge them into the synced branch, or switch the picker to the branch you pushed. You cannot switch branches while Lovable is editing. If the card says GitHub is ahead and a push already landed on that branch, the notify was missed. Push one more commit to that same branch. An empty commit is enough. If the card says the sides have diverged, stop. That push replaces edits that exist only in Lovable. Confirm those edits are already on GitHub, or let the project owner restore the backup, before you push.

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

    Stop rewriting the synced branch

    If you force-pushed, rebased, or squashed the synced branch, the next sync saves Lovable's copy and then replaces the project with GitHub's history. The project owner uses Review restore within 24 hours, or Check for saved Lovable work after that. Merge lovable-sync with a merge commit. Do not squash it. A protected main that rejects Lovable belongs on a branch you merge through review, or you merge lovable-sync yourself. ! [rejected] (fetch first) is the fetch-first page. Do not answer it with --force. A push that GitHub rejected for a secret is the secrets page. Fetching will not clear it.

  4. 4

    Prove the card, then publish only if you meant to

    In sync with GitHub is the sync working. Open the changed files in the preview. The live lovable.app site does not change until you publish. If the failure is a file over 100 MB, remove the listed files and let sync retry. Do not ask the model to regenerate the project so the card looks calm.

Why it happens

GitHub sync is two-way, and it is one branch. Project settings, then Git, then GitHub, shows the repository, the sync status card, and the branch picker. The picker is the only branch Lovable edits. It starts as the repository's default branch, usually main. Commits on any other branch stay out of the project until you merge them into that branch or switch the picker to them. A push updates the preview after the card catches up. It does not publish, and it does not deploy an Edge Function or run a migration that arrived in git.

The card is the diagnosis. In sync with GitHub means both sides are on the same commit. Lovable is N commits ahead of GitHub means those commits go out on the next sync. GitHub is N commits ahead of Lovable means Lovable has not pulled them. Lovable and GitHub have diverged means each side has commits the other does not. Lovable then pushes its work to lovable-sync instead of the synced branch, and the next sync from GitHub replaces Lovable's copy of the branch with GitHub's. Re-check compares again. It does not sync. The comparison covers the 50 most recent commits on each side, so a count can read 50+.

Lovable pulls a push when GitHub notifies it. If that notice never arrives, the card stays on GitHub is N commits ahead, and a later check does not go back and fetch the missed push. Reconnect does not pull those commits either. It only repairs access. The documented way to make Lovable pull is a new push to the synced branch, including an empty commit. That push is safe only when your latest Lovable edits are already on GitHub. If the card says the two sides have diverged, the push replaces the Lovable-only edits. Lovable saves a backup first. The project owner restores it from the notice in the editor or in Project settings, then Git. Other roles can see the notice and cannot restore. The notice shows for 24 hours. After that, the owner uses Check for saved Lovable work. Restore Lovable work syncs the saved commits back. If GitHub has nothing newer, they land on the synced branch. Otherwise they land on lovable-sync, and you merge that branch with a merge commit, not a squash or rebase.

Do not force-push, rebase, or squash commits that are already on the synced branch. Lovable keeps its own copy of that history. A rewrite makes the next sync save a backup and then replace the project with yours. Undo with a new commit that reverts the change. A protected branch rejects Lovable's push. Lovable then pushes to lovable-sync and tells you to merge that branch. Later rejections append to the same branch unless you have added your own commits there, in which case the next push is lovable-sync- plus a suffix. Someone deleting the synced branch makes the picker jump to lovable-fallback. Pick or recreate the original branch.

The repository link is not something you can point at a repo you already had. Connect creates a new private repository. Disconnect leaves that repository on GitHub and stops sync. Reconnect creates another new repository. It does not reattach the old one. Renaming the repository, your username, or the organization keeps the sync, and Lovable updates the link. A transfer to another account or organization keeps the sync only when this workspace already has a GitHub connection for the new owner. Otherwise the project disconnects. Deleting the repository stops the sync. Restore it on GitHub and the sync resumes, or disconnect and connect to get a new repository with the current project. Moving the Lovable project to another workspace breaks the link on purpose.

A Reconnect prompt is the GitHub app, not a bad commit. Suspended means unsuspend the Lovable GitHub App, and every project on that connection resumes. Uninstalled means the workspace connection is gone and every linked project was disconnected. Add the connection again and connect each project, which creates new repositories. The old ones stay on GitHub. No access means the app install is Only select repositories and this repo is not selected, or it is not in All repositories. Add it. The app asks for Contents (write), Metadata (read), Pull requests (write), Workflows (write), and Administration (write), and it subscribes to push, pull_request, repository, and delete. Workspace owners and admins install and reconnect the app. Workspace or project owners and admins connect and disconnect a project. Editors can view the card, switch branches, and create branches. A popup that never opens is the browser blocking GitHub. Allow popups for Lovable.

GitHub rejects a push that contains a file over 100 MB. After a few failed attempts the GitHub settings show Your project contains files that exceed the maximum file size limit (100 MB) and list the files. Delete them and let sync retry. A file that is already in history needs support to clean. Separately, Lovable cannot save a file over 10 MB into the project.

The next error you'll probably hit

Once this is fixed, the usual follow-up is git push rejected (fetch first). The remote branch has commits your branch does not. Git refused the push so those commits would not be discarded. A second message, refusing to merge unrelated histories, means the two repos never shared a commit.

Prompt to paste back into your AI tool

Paste this above the error.

Lovable GitHub sync not working. The sync status card says:
<In sync with GitHub, Lovable is N commits ahead, GitHub is N commits ahead, Lovable and GitHub have diverged, or the Reconnect sentence>

The branch picker shows:
<branch>

The last command I ran, if any, was:
<git command and the first error, or "none">

Do not run git push --force or --force-with-lease. Do not rebase or squash the synced branch. Do not disconnect the project. Do not create a new repository. Do not put a secret in a file to get the push through.

1. If the screen says the GitHub app is suspended, uninstalled, or missing this repository, tell me the Reconnect step. Say that uninstalling means each project connects again and gets a new repository.
2. If my commits are on a branch other than the picker, tell me to merge into that branch or switch the picker. Do not change application code.
3. If the card says GitHub is ahead, tell me to push one new commit to that branch, and show the empty commit only when my latest Lovable edits are already on GitHub.
4. If the card says diverged, or I rewrote history, stop. Tell the project owner to use Review restore or Check for saved Lovable work. Do not push.
5. If the message is fetch first or Push cannot contain secrets, send me to that error. A green sync card does not publish the site.

Common questions

+I pushed and Lovable never picked up the commits. Is the connection dead?

Usually the commits are on a branch the picker is not syncing, or GitHub's push notice never arrived. Merge into the synced branch, or switch the picker. If the card already says GitHub is ahead, push one new commit to that branch. Re-check and Reconnect do not pull the missed commits.

+I renamed the repo, or force-pushed main. Which one breaks sync?

A rename of the repository, username, or organization keeps sync. A force-push, rebase, or squash of the synced branch rewrites history Lovable still has. The next sync backs up Lovable's copy and replaces the project. The project owner restores it. The next undo should be a revert commit.

+Lovable pushed to lovable-sync instead of main. What do I merge?

GitHub rejected the push to the synced branch, often because the branch is protected or the histories diverged. Review lovable-sync and merge it with a merge commit. If you added your own commits on lovable-sync, the next rejected push uses a lovable-sync- branch instead. Leave that branch's extra commits in place.

+Can I point the project at the GitHub repo I already have?

No. Connect always creates a new repository. Disconnect leaves the old one on GitHub, and connecting again creates another new repository. Deleting the linked repository stops sync until you restore it or connect a new one.

Related errors