- GitHub (github.com, GitHub Enterprise Cloud with data residency, or GitHub Enterprise Server)
- GitLab (GitLab.com or a self-managed GitLab instance)
- Bitbucket (Bitbucket Cloud)
Why sync your project to a Git repository
- Back up your code. Store your project safely outside Lovable, in an account you control.
- Collaborate with developers. Use branches, pull or merge requests, and code reviews alongside building in Lovable.
- Work locally in your IDE. Clone the repository, edit and commit locally, and push. Your changes sync back into Lovable.
- Deploy outside Lovable. Self-host or deploy to other platforms. See Deployment, hosting, and ownership options.
- Keep a copy of your code within your own infrastructure. Sync to GitHub Enterprise Cloud with data residency, GitHub Enterprise Server (both Enterprise plan), or a self-managed GitLab instance.
How Git sync works
Git sync has two layers, on every provider:- A workspace connection authorizes Lovable to access a Git account, organization, group, workspace, or instance. Connections belong to the workspace, and any project in the workspace can use them. A workspace can have multiple connections, including connections to GitHub, GitLab, and Bitbucket at the same time.
- A project repository link connects one Lovable project to one repository under one of those connections. When you link a project, Lovable creates a new repository and starts two-way sync automatically.
- Lovable commits the edits you make in Lovable and pushes them to your repository.
- Commits you push to the synced branch appear in your Lovable project.
- Synced commits go through the same checks as edits made in Lovable. If they change your dependencies, Lovable runs the dependency audit and updates the project’s Security view.
- Lovable edits and syncs one branch at a time. Commits on other branches don’t appear in Lovable until you merge them into the synced branch or switch the synced branch. You can switch branches and create new branches from Lovable on every provider.
Sync status
The sync status card in Project settings → Git compares the synced branch in Lovable with the same branch on your provider. Each label names your provider. On a GitHub project, the card shows one of the following states:- In sync with GitHub: Lovable and GitHub are on the same commit.
- Lovable is N commits ahead of GitHub: Lovable pushes these changes to GitHub on the next sync.
- GitHub is N commits ahead of Lovable: Lovable hasn’t pulled these commits yet. If this state persists after you push, follow the troubleshooting entry for GitHub, GitLab, or Bitbucket.
- Lovable and GitHub have diverged: Lovable and GitHub each have commits that the other does not. Lovable pushes its changes to a separate
lovable-syncbranch instead of the synced branch, and the next sync from GitHub replaces Lovable’s version of the branch with the GitHub version. - Couldn’t check GitHub right now or Sync state couldn’t be determined: the comparison failed, or the two histories don’t meet within the commits Lovable compares. Click Re-check to compare again.
Roles and permissions
- Workspace owners and admins add, update, and delete workspace connections, and enable or disable commit attribution.
- Workspace or project owners and admins connect and disconnect projects.
- Editors and above view sync status and work with the synced repository.
Choose a provider
Each project links to one repository on one provider. All providers support the same core two-way sync.Commit attribution
Commits that Lovable pushes are not authored by the workspace member who triggered them. On GitHub they come from the Lovable GitHub app. On GitLab and Bitbucket, Lovable pushes them through the account that authorized the workspace connection. For how each platform still credits the member behind a change, see commit attribution for GitHub, GitLab, and Bitbucket. To record who triggered each change, a workspace owner or admin can enable Include member email addresses in commits in Workspace settings → Git → Commit attribution. The setting is available on the Business and Enterprise plans and is disabled by default. On other plans the section does not appear. While it is enabled, commits Lovable makes on a member’s behalf carry that member’s email address on its own line in the commit message body:- Members with no connected GitHub account. Lovable cannot co-attribute their commits at all, so without this setting nothing in the repository records who triggered the change.
- GitLab and Bitbucket repositories. Lovable does not add the co-author line on these providers, so without this setting nothing in the repository records who triggered the change.
Disconnecting and reconnecting
When you disconnect a project, Lovable stops the sync and changes nothing else:- Your repository stays on GitHub, GitLab, or Bitbucket, intact with all history and files.
- Your project and its code stay in Lovable. Changes you make afterwards stay in Lovable only.
Limitations
These apply to every provider:- Export only. You can’t import an existing repository into Lovable. When you connect a project, Lovable always creates a new repository.
- One repository per project. Each Lovable project links to exactly one repository on one provider. To switch providers, disconnect the project first.
- One branch at a time. Only commits on the synced branch appear in Lovable.
- Keep the repository where it is. Don’t move or delete a connected repository, or rename the account, organization, group, or workspace it lives in. Each of these changes breaks the sync. You can rename the repository itself on GitHub and Bitbucket, but on GitLab a rename breaks the sync.
- Reconnecting creates a new repository. You can’t re-link a previously disconnected repository.
- No sync for drafts. A draft doesn’t appear as a branch in your repository. Its code reaches the repository after you accept the draft, like any other project change.
FAQ
Do I need to know Git to use this?
Do I need to know Git to use this?
Do I need Git sync just to get a copy of my code?
Do I need Git sync just to get a copy of my code?
Can I use more than one Git provider?
Can I use more than one Git provider?
Does pushing to my repository update my live site?
Does pushing to my repository update my live site?
Is my database included in the repository?
Is my database included in the repository?
Can I import an existing repository into Lovable?
Can I import an existing repository into Lovable?
Do I need commit attribution if my team already connected their GitHub accounts?
Do I need commit attribution if my team already connected their GitHub accounts?
Can I remove member email addresses from commits I already pushed?
Can I remove member email addresses from commits I already pushed?
Is my code still in Lovable after I connect?
Is my code still in Lovable after I connect?