- 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. See Work locally in your IDE.
- 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.Work locally in your IDE
When a project syncs with a repository, you can clone that repository, edit the code with your own IDE or coding assistant, and push the result back. Commits on the synced branch appear in your Lovable project, and you continue building on them in Lovable. Repository access and project access are separate. To push, you need write access to the repository on your Git provider. To keep building in Lovable, you need an editor role on the project. Check the README andpackage.json in the repository for what you need installed and for the commands that install dependencies and start the app.
Keep Lovable and your work on separate branches
Lovable edits and syncs one branch at a time. The branch picker in Project settings → Git shows which one. Keep Lovable on that branch, usuallymain, and make your local changes on a feature branch. The feature branch stays out of your Lovable project until you merge it into the synced branch, so unreviewed work does not reach the project. When you merge, Lovable pulls the result.
Do not force-push, rebase, or squash commits that are already on the synced branch. Lovable keeps its own copy of that branch. When you rewrite its history, the next sync replaces Lovable’s copy with yours, and edits made only in Lovable can be lost. To undo a change, add a commit that reverts it.
If your team requires a pull or merge request for every change to main, switch Lovable to a feature branch of its own and merge its work through the same review process. Your Git provider rejects Lovable’s pushes to a protected branch, and Lovable then pushes to the lovable-sync branch instead. See the troubleshooting entry for GitHub, GitLab, or Bitbucket.
Hand over work between Lovable and your IDE
Before you clone or merge, let any Lovable edit in progress finish and check the sync status card. When the card reports that Lovable and your provider are in sync, your local copy starts from the latest Lovable changes. After you merge, the card shows the in-sync state again when Lovable has pulled your commits.Check the environment before you run the app
A clone gives you the code, not the services the app calls. In a project that uses Lovable Cloud, the repository’s.env file carries the URL and publishable key of your Cloud backend, for example as VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY. A local app that keeps that configuration reads and writes the same backend as your published app, so records you create or delete locally change real data. Use test accounts and records while you test writes. A Git branch does not give you a separate database.
The repository does not carry everything sign-in and server-side calls need. An authentication provider redirects only to URLs it knows, so add your local URL where your provider configures redirect URLs. Secrets you store in Lovable stay out of the repository, so server-side code that reads them needs those values wherever it runs. The credentials behind app + chat connectors and Lovable AI are managed by Lovable and cannot be copied out. In an older React + Vite app, those calls run in Edge Functions on your Cloud backend, so a local app that uses that backend can still make them. In a newer app (created from May 13, 2026, which uses TanStack Start), the server code runs on your machine, so connector and AI calls fail locally. Test them in the Lovable preview or in your published app. When the app works in Lovable but a request fails locally, check the service that request reaches.
Backend files in your commits
In a project that uses Lovable Cloud, the repository also contains your backend code: Edge Functions undersupabase/functions/ and the migration files under supabase/migrations/ that record your database structure. Lovable does not deploy a changed Edge Function or run a new migration file when your commits sync.
- Edge Functions: after the commit syncs, ask Lovable in the project chat to deploy the function, then check it under More → Cloud → Edge functions.
- Migrations: to change the database structure, ask Lovable in the project chat, or run the SQL yourself in the SQL editor.
Continue building in Lovable
After your merge reaches the synced branch and the sync status card shows both sides in sync, open the changed files in the code editor and test the behavior in the preview. Then tell Lovable what changed, so its next edit builds on your work: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. Deleting a connected repository stops the sync. On GitHub and Bitbucket, the sync follows a renamed repository, a renamed account, organization, or workspace, and a repository moved to another account, organization, or workspace that your Lovable workspace also has a connection to. A move to a destination without a connection disconnects the project. On GitLab, a rename or move of the project or its group 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?
Can I use any IDE or coding assistant when I work locally?
Can I use any IDE or coding assistant when I work locally?
Does working locally use credits?
Does working locally use credits?
Will Lovable keep the code I wrote outside Lovable?
Will Lovable keep the code I wrote outside 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?