Sync your Lovable project code with GitHub, GitLab, or Bitbucket
Git sync automatically mirrors your Lovable project code to GitHub, GitLab, or Bitbucket. Edits you make in Lovable are pushed to your repository, and commits pushed to your synced branch update in Lovable.
Anyone who wants an external code backup, plans to work locally on their computer, or needs to collaborate with software engineers.
Do this, in order
- 1
Go to Project settings and open the Git tab.
This is where you manage your repository connection and view synchronization status.
- 2
Select your Git provider and authorize the workspace connection to create a repository.
Lovable generates a new repository under your account and initiates automatic two-way syncing.
- 3
Keep Lovable connected to one main branch and make manual code edits on separate feature branches locally.
Working on separate branches prevents unfinished local work from interrupting your Lovable project.
- 4
Merge local commits into the synced branch without squashing, rebasing, or force-pushing.
Rewriting commit history can cause diverged branches and prompt Lovable to overwrite or back up your work.
- 5
Check the sync status card in Project settings to confirm both sides match before prompting Lovable again.
This ensures Lovable builds directly on top of your latest external changes.
Paste this into your project
I have merged external code changes from our Git repository into the active branch. Please inspect the updated files, preserve all custom functionality that was introduced, and confirm the application compiles and renders correctly.
Words decoded
- Two-way sync
- A setup where changes made on either side (Lovable or your Git repository) automatically copy over to the other side.
- Repository
- A storage folder hosted on a code service like GitHub that tracks the full history of every file.
- Commit
- A saved snapshot of changes made to the project's files.
- Branch
- An isolated copy of your code where you can test changes without altering the main project.
- Force-push / Rebase
- Advanced Git commands that rewrite past history, which can break automatic synchronization tools.
Where people get stuck
- You cannot import an existing repository into Lovable; Lovable must create the repository when you first connect.
- Pushing code to your repository updates the editor preview but does not publish changes to your live site.
- Lovable does not automatically run database migrations or deploy Edge Functions synced from Git; you must trigger or verify them in Lovable.
- Running your project locally connects to your real backend database by default, so test data will affect live production records.
- On GitLab, renaming or moving the repository or group breaks the sync connection.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.