KBAISE/ for lovable
Library
Docs

Sync your Lovable project code with GitHub, GitLab, or Bitbucket

about 5 minBuildingchecked 44h agoOfficial page
The short version

You can connect your Lovable project to a GitHub, GitLab, or Bitbucket account to automatically back up your code and work with it outside Lovable. This creates a two-way sync, so changes you make in Lovable appear in your code repository, and changes you push to the repository appear back in Lovable.

Anyone who wants to keep their Lovable project code in their own version control system for backup, collaboration, or local development.

Do this, in order

  1. 1

    Go to your project's settings, then find the 'Git' tab.

    This is where you manage the connection between your Lovable project and your code repository.

  2. 2

    Choose your preferred code hosting service (GitHub, GitLab, or Bitbucket) and follow the specific setup instructions for that service.

    Each service has slightly different steps to authorize Lovable to access your account and create a new repository for your project.

  3. 3

    After connecting, make changes in Lovable as usual, or clone the new repository to your computer and make changes there.

    Lovable automatically keeps your project and the connected repository in sync, so changes made in either place will reflect in the other.

Paste this into your project

I need to connect my Lovable project to a new GitHub repository for backup and collaboration. Please set up two-way Git sync for this project with GitHub.

Words decoded

Git sync
A feature that automatically keeps your Lovable project's code identical to the code in a separate online storage location (like GitHub), updating both sides whenever changes are made.
repository
An online folder where your project's code and its entire history of changes are stored.
IDE
A special program on your computer that helps you write, test, and fix computer code more easily.
commit
A snapshot of your code at a specific point in time, along with a message describing the changes made.
branch
A separate version of your project's code that you can work on without affecting the main version, useful for trying out new features or fixes.
pull request / merge request
A way to propose changes from one branch to another, often used for team review before combining code.
force-push, rebase, squash commits
Advanced Git actions that rewrite the history of changes in your code. These can cause problems with Lovable's sync if used on the main synced branch.
commit attribution
The process of recording who made a specific change (commit) to the code, often showing their name or email address.

Where people get stuck

  • Do not force-push, rebase, or squash commits on the synced branch, as this can cause Lovable to lose its own changes.
  • Be aware that email addresses in commit messages are publicly visible if your repository is public, so consider disabling commit attribution for public projects.
  • Remember that Git sync exports your code but does not deploy your live site; you still need to publish from Lovable.
  • Understand that your database content is not included in the repository, only the files that define its structure.
  • Do not expect to import an existing repository into Lovable; Git sync always creates a new repository.
  • If you rename or move a GitLab project or group, the sync will break.
  • If you disconnect a project and then reconnect it, Lovable will create a *new* repository, not re-link to the old one.

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.