Sync your Lovable project with GitHub
You can connect your Lovable project to GitHub to keep an automatic two-way copy of your code. Any change made in Lovable pushes to GitHub, and any change pushed to GitHub syncs back into Lovable.
Anyone who wants an external code backup, plans to collaborate with developers, or wants to edit code locally in their own software editor.
Do this, in order
- 1
Open Workspace settings, go to Git, select GitHub, and click Add connection to authorize your GitHub account or organization.
This grants Lovable permission to create and manage repositories on your GitHub profile.
- 2
Open your project's Git settings by clicking the plus icon next to the chat bar and choosing Project then GitHub, or by navigating to Project settings and choosing Git.
This takes you directly to the connection manager for your active project.
- 3
Click Connect next to your connected GitHub account to let Lovable generate a new private repository.
Lovable creates the repository and starts synchronizing your code automatically.
- 4
Use the branch dropdown inside Project settings under Git to switch branches or create a new branch before testing big edits.
Lovable only edits and syncs one branch at a time, always branching off whatever branch is currently active.
Paste this into your project
Create a clear, well-structured README.md file in the project root explaining the application's purpose, key features, and local development setup instructions so the repository is easy to understand on GitHub.
Words decoded
- Repository
- A storage space on GitHub that holds all of your project's files, code, and complete edit history.
- Two-way sync
- A setup where changes flow in both directions: Lovable updates GitHub, and GitHub updates Lovable.
- Branch
- A separate parallel version of your project code where you can make changes without affecting the main version.
- Commit
- A saved checkpoint that records specific code changes and who made them.
Where people get stuck
- You cannot link an existing repository that already has code; Git sync always creates a brand-new repository.
- Disconnecting a project and reconnecting it later will create another new repository rather than linking back to your previous one.
- Deleting the linked repository on GitHub will permanently break synchronization.
- Creating a new branch will copy from your currently active branch, not necessarily the main branch, so make sure you are on main first if that is your intended starting point.
- Browser popup blockers can prevent the GitHub authorization window from opening when you click Add account.
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.