How GitLab Git sync works
Like all Git sync, the GitLab integration has two layers:- A workspace connection
- A project repository link
Workspace connection
A workspace connection authorizes Lovable to access a GitLab namespace (your personal account or a group) through OAuth. Lovable requests theapi scope, which it needs to create projects, configure webhooks, manage branches, and open merge requests.
Every project in the workspace can use the same workspace connection.
A workspace can contain:
- Multiple GitLab connections
- Multiple group namespaces from the same GitLab account or instance
- One personal-account namespace (a workspace can hold only one personal GitLab account, alongside any number of groups)
- Both GitLab connection types (GitLab.com and Self-Managed)
Project repository link
A project repository link connects one Lovable project to one GitLab repository. When connected:- Changes made in Lovable sync to GitLab
- Changes pushed to the active GitLab branch sync back into Lovable
- Lovable only edits and syncs one branch at a time
GitLab Git sync connection types
Lovable supports two GitLab connection types:- GitLab.com
The hosted service managed by GitLab Inc. You authorize Lovable with your GitLab.com account. - GitLab Self-Managed
A GitLab instance that your organization runs on its own servers. You create an OAuth application in your instance, so credentials remain under your control, and allowlist Lovable’s IP ranges.
Role-based access for GitLab integration
Create a workspace GitLab connection
Workspace admins and owners can create workspace connections from:- Workspace settings → Git → GitLab → Add connection
- Project settings → Git → GitLab → Add connection (if a project has not been connected yet)
- GitLab.com (hosted)
- GitLab Self-Managed
Add a new connection
Authorize your GitLab account
api scope, which is required to create projects, configure webhooks, manage branches, and open merge requests.Select a namespace
- Select your personal account or one of your GitLab groups.
- Click Connect next to the namespace you want to use.
Link a project to a GitLab repository
When there is an active workspace GitLab connection, workspace or project admins and owners can connect a Lovable project to a GitLab repository.- When you connect a project, Lovable creates a new GitLab repository. The repository is private by default, so nobody can see your code unless you change its visibility on GitLab.
- Each Lovable project can connect to one repository.
Open the project's GitLab settings
Connect the project
Manage a project’s repository sync
After connecting a project to a GitLab repository, you see the following in the project’s GitLab settings:- Repository status as Connected
- Sync status card showing whether Lovable and GitLab are on the same commit
- Branch picker with active branch name (GitLab branch synced with Lovable)
- Clone URLs (HTTPS, SSH)
- Option to View on GitLab (available from the dropdown)
- Option to Disconnect (available from the dropdown)
main). Changes pushed to the currently active branch sync back into Lovable.
If the sync status card says Lovable and GitLab have diverged, Lovable and GitLab each have commits that the other does not. Lovable pushes its changes to the lovable-sync branch instead of the synced branch, as described under Troubleshooting, and the next sync from GitLab replaces Lovable’s version of the branch with the GitLab version. Re-check compares the branches again and doesn’t sync anything.
Switch branches
Use the branch picker in the project’s GitLab settings to change which branch Lovable edits and syncs.- Click the branch picker.
- Search or select a branch.
- Click the branch to switch.
Create a new branch
You can create a branch from the same picker without leaving Lovable.- Click the branch picker.
- Click Create branch at the bottom of the list.
- Enter a branch name. Lovable validates it against empty names, invalid characters, and duplicates.
Branch names must follow Git naming rules (no spaces, .., leading or trailing dots or dashes, and special characters such as ~ ^ : ? * [ ] \).
Source: <active branch> in the dialog). Lovable automatically switches to the new branch and starts editing and syncing it.
Clone the repository locally
After connecting a project, Lovable provides clone URLs for:- HTTPS
- SSH
Commit attribution
Commits made by Lovable are authored by Lovable’s bot identity. In the commit log the author readsgpt-engineer-app[bot], an earlier name for that identity, and GitLab does not link it to an account. Lovable pushes the commits through the GitLab account that authorized the workspace connection, so GitLab attributes the pushes to that user. That account is not necessarily the member who made the change, and Lovable does not add a Co-authored-by line on GitLab repositories, so nothing in the commit identifies the member.
To record who triggered each commit, enable Include member email addresses in commits in workspace settings. See Commit attribution (Business and Enterprise plans).
Disconnect a project from GitLab
When you disconnect a project, Lovable removes the link between the project and its GitLab repository. When you disconnect:- Sync stops. The two-way connection between Lovable and GitLab ends.
- Your repository stays on GitLab. It remains intact with all history and files.
- Your project and its code stay in Lovable. Future changes are stored only inside Lovable.
- Lovable creates a new repository with the current version of your project.
- The original repository stays unchanged on GitLab and is no longer linked to Lovable.
Unlink projects from a workspace GitLab connection
Workspace admins and owners can remove specific projects from a connection without deleting the connection entirely. The connection remains available for other projects.Open GitLab settings
Open the connection
Select projects
Confirm
- Click Unlink N projects (where
Nis the number of projects you selected) - Click Unlink to confirm
Delete a workspace GitLab connection
Workspace admins and owners can delete GitLab connections. When you delete a workspace GitLab connection, Lovable:- Removes the connection for all projects
- Stops syncing for linked projects
- Keeps the repositories on GitLab
- Deletes the stored credentials
Open GitLab settings
Open the connection you want to remove
Review linked projects
Delete
Limitations
The GitLab Git sync integration currently does not support:- Importing existing GitLab repositories into Lovable. You can only export from Lovable to GitLab.
- Reconnecting to the same repository after disconnecting. Lovable creates a new repository on reconnect.
- Connecting the same personal account or group more than once, or more than one personal GitLab account per workspace.
- Automatically following repository renames or moves. Unlike GitHub, renaming or moving a GitLab project breaks the sync.
Troubleshooting
Your browser blocked the GitLab sign-in window. Allow pop-ups for this site and try again.
Your browser blocked the GitLab sign-in window. Allow pop-ups for this site and try again.
lovable.dev in your browser’s site settings, then select Authorize with GitLab (or Reconnect) again.My commits and pushes from GitLab aren't showing up in Lovable.
My commits and pushes from GitLab aren't showing up in Lovable.
main).If you pushed commits to a different branch in GitLab, you have two options:- Merge your changes into the synced branch. For example, open a merge request from your feature branch into
mainand merge it. Lovable then picks up those commits. - Switch the synced branch in Lovable. In your project’s GitLab settings, select the branch where your commits live. Lovable starts editing and syncing that branch instead, and your commits will appear.
I pushed to the synced branch, but the commits don't appear in Lovable and the sync status says GitLab is ahead.
I pushed to the synced branch, but the commits don't appear in Lovable and the sync status says GitLab is ahead.
- You’re pushing to the repository and branch shown in Project settings → Git → GitLab. Commits on other branches don’t sync.
- Your latest Lovable edits are already in the repository on GitLab. If the sync status says Lovable and GitLab have diverged, the push replaces Lovable’s version of the branch with the GitLab version, and the project no longer contains edits made only in Lovable. Contact Lovable Support before you push if you need those edits.
I see a "lovable-fallback" branch in the branch picker.
I see a "lovable-fallback" branch in the branch picker.
lovable-fallback so that you can continue editing. Your repository is otherwise unchanged.Pick another branch or recreate the original branch. After you switch away, you can leave or delete lovable-fallback in GitLab.My push from Lovable ended up on a "lovable-sync" branch instead of the synced branch.
My push from Lovable ended up on a "lovable-sync" branch instead of the synced branch.
lovable-sync instead, and your project’s GitLab settings show “Your changes conflict with commits on <your branch> and could not be merged automatically. They were pushed to the branch lovable-sync instead. Merge that branch into <your branch> to apply them.”Open that branch on GitLab, review the changes, and merge them into your protected branch through your usual review process.When a later push is rejected too, Lovable adds those changes to the same lovable-sync branch. If you’ve added your own commits to lovable-sync, Lovable leaves them untouched and pushes to a new branch named lovable-sync-<timestamp> instead. Review and merge that branch the same way.GitLab Self-Managed: Auth token is expired, but I am unable to reconnect the GitLab connections.
GitLab Self-Managed: Auth token is expired, but I am unable to reconnect the GitLab connections.
- In GitLab, go to Settings → Applications or Admin Area → Applications, find the Lovable application, and revoke its access.
- In Lovable, trigger a sync by making a change in a project linked to your GitLab instance (or wait for the next one). The connection will move into a “needs reconnect” state.
- In Lovable, as a workspace admin, in the GitLab connection, select Reconnect and sign into GitLab again.
FAQ
Can I push large files to my GitLab repository?
Can I push large files to my GitLab repository?
Is the GitLab project Lovable creates public or private?
Is the GitLab project Lovable creates public or private?
Do I need to know GitLab to use this feature?
Do I need to know GitLab to use this feature?
What happens if I rename, move, or delete my GitLab project?
What happens if I rename, move, or delete my GitLab project?
What happens if I rename my GitLab username or group?
What happens if I rename my GitLab username or group?
How can I switch to a different GitLab account?
How can I switch to a different GitLab account?
- Disconnect the project from the current GitLab connection (there’s a disconnect option in the project’s GitLab settings)
- Delete the existing connection if you want a different personal account (a workspace allows only one personal GitLab account)
- Create a new connection with the correct GitLab account
- Reconnect the project to the new connection
Can I disconnect from GitLab?
Can I disconnect from GitLab?
Can I import an existing GitLab repo into Lovable?
Can I import an existing GitLab repo into Lovable?
Can I edit a non-default branch from inside Lovable?
Can I edit a non-default branch from inside Lovable?
main) first.Can I connect multiple GitLab groups?
Can I connect multiple GitLab groups?
What's the difference between GitLab.com and GitLab Self-Managed?
What's the difference between GitLab.com and GitLab Self-Managed?
What OAuth scopes does Lovable request?
What OAuth scopes does Lovable request?
api scope, which is the minimum required to create projects, configure webhooks, manage branches, and open merge requests on your behalf.My self-managed GitLab instance is behind a VPN. Will it work?
My self-managed GitLab instance is behind a VPN. Will it work?