You don’t need Git to use Lovable. Many users build and launch entirely within Lovable. If you only need a copy of your code, open the Code editor and click Download codebase at the bottom of the file tree sidebar (paid plans).
- GitHub (github.com, GitHub Enterprise Cloud with data residency, or GitHub Enterprise Server)
- GitLab (GitLab.com or a self-managed GitLab instance)
Want your app to call the GitHub REST API to read repositories, issues, and pull requests instead? Use the GitHub API connector.
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, for both GitHub and GitLab:- A workspace connection authorizes Lovable to access a Git account, organization, group, or instance. Connections belong to the workspace and can be reused by any project in it. A workspace can hold multiple connections, including connections to both GitHub and GitLab at the same time.
- A project repository link connects one Lovable project to one repository under one of those connections. Linking a project creates a new repository and starts two-way sync automatically.
- Edits made in Lovable are committed and pushed to your repository.
- Commits pushed to the synced branch flow back into your Lovable project.
- 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 both providers.
Who can do what
- Workspace owners and admins add, update, and delete workspace connections.
- 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. Both providers support the same core two-way sync.| GitHub | GitLab | |
|---|---|---|
| Hosted service | github.com (all plans) | GitLab.com (all plans) |
| Your own infrastructure | GitHub Enterprise Cloud with data residency, or GitHub Enterprise Server (both Enterprise plan) | Self-managed GitLab instance (all plans) |
| Connection method | Lovable GitHub App (or your own copy of it on Enterprise Server) | OAuth with your GitLab account |
| Synced branch | Active branch: switch and create branches from Lovable | Active branch: switch and create branches from Lovable |
| Repository renames | Followed automatically | Break the sync |
Disconnecting and reconnecting
Disconnecting a project stops the sync, nothing more:- Your repository stays on GitHub or GitLab, intact with all history and files.
- Your project and its code stay in Lovable. Future changes are stored only in Lovable.
Limitations
These apply to both providers:- Export only. You can’t import an existing repository into Lovable. Connecting a project always creates a new repository.
- One repository per project. Each Lovable project links to exactly one repository.
- One branch at a time. Only the synced branch flows back into Lovable.
- Keep the repository where it is. Don’t rename, move, or delete a connected repository (or the account, organization, or group it lives in). Doing so breaks the sync.
- Reconnecting creates a new repository. You can’t re-link a previously disconnected repository.
FAQ
Do I need to know Git to use this?
Do I need to know Git to use this?
No. Set up the connection once and your code is safely stored in your repository. You only need Git knowledge for advanced workflows like branching, pull or merge requests, or CI/CD.
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?
No. On paid plans you can download your code directly: open the Code editor and click Download codebase. Git sync is for ongoing two-way sync and collaboration.
Can I use both GitHub and GitLab?
Can I use both GitHub and GitLab?
A workspace can hold GitHub and GitLab connections side by side, and different projects can sync to different providers. A single project links to one repository on one provider.
Can I import an existing repository into Lovable?
Can I import an existing repository into Lovable?
No. Git sync only exports from Lovable. Connecting a project creates a new repository.
Is my code still in Lovable after I connect?
Is my code still in Lovable after I connect?
Yes. Your project remains fully editable in Lovable; the repository is a synced copy that you own. Disconnecting never deletes code on either side.