What is GitHub?
Think of GitHub as a specialized online storage service for code, like Google Drive, but built specifically for software projects. It keeps track of every change you make, lets multiple people work together, and makes it easy to share your work with others.When to use the GitHub integration
You might want to connect GitHub if you:- Want your own copy of the code: Keep a personal backup outside of Lovable
- Need to share with developers: Give your technical team access to the code
- Plan to move elsewhere: Export your project to continue building it in other tools
You don’t need GitHub to use Lovable. Many users build and launch their projects without ever connecting GitHub.
Before you begin
Here’s what you should know before connecting GitHub:- You’ll need a GitHub account: If you don’t have one, you can create a free account at github.com
- Your code moves to GitHub: Once you transfer your project, Lovable doesn’t keep a separate copy.
- Keep your GitHub repo in place: Your project must stay at the same location in GitHub (same name, same organization, same account). Moving, renaming, or deleting it will break the connection to Lovable.
- Two-way sync: Changes you make in Lovable will appear in GitHub, and changes made in GitHub will appear in Lovable. They stay in sync automatically.
Connecting your project to GitHub
Follow these steps to export your Lovable project to GitHub.1
In your Lovable project editor, look for the GitHub icon in the top right corner and click it.
2
Click the Connect GitHub button. This will take you to the GitHub settings page inside your project settings.
3
Click Connect GitHub again on the settings page. A small window will appear asking you to log into GitHub.
4
Enter your GitHub username and password
5
GitHub will ask you to authorize the Lovable app in your account or organizations. This means you’re giving Lovable permission to create and update your code repository on GitHub. Click Authorize to continue.
6
After authorizing, you can press Connect GitHub again and choose which GitHub organization (your account or team account) should store your code. Select the one you want from the list.
7
Click Transfer Anyway to finish. Your code is now in your own GitHub repository!
What happens after connecting
Once connected:- Your code lives in your GitHub account and repository.
- Changes made to the main branch sync automatically: Edit in Lovable or GitHub, both stay updated
- You can download it anytime: Get the code files directly from GitHub whenever you need them
- Others can access it: Share your GitHub repository with developers or teammates
Working with branches (Labs feature)
If you’re comfortable with GitHub, you can create branches inside of GitHub. Think of these as temporary copies where you can test changes without affecting your live project. To learn more about branching inside of Lovable, please see this page.FAQ
What if I rename, move or delete my GitHub repository?
What if I rename, move or delete my GitHub repository?
If you change the repository name, move it to a different organization or delete it, Lovable won’t be able to find it anymore. Your project will stop syncing, and you won’t be able to edit it in Lovable.To fix this: Restore the repository to its original location with its original name. If you deleted it you can read about restoring it here. Once it’s back in place, the connection should work again.
What if I rename my organization or change username inside of GitHub?
What if I rename my organization or change username inside of GitHub?
If you rename your organization or change username, Lovable won’t be able to find the repository anymore. Your project will stop syncing, and you won’t be able to edit it in Lovable.You can fix this by undoing the changes. When your organization or username match what they were during the GitHub export the project should sync again.
I clicked Connect GitHub but nothing happened
I clicked Connect GitHub but nothing happened
This usually means your browser blocked the GitHub login popup. Look for a small icon in your browser’s address bar (often a blocked popup notification) and click it to allow popups from Lovable. Then try connecting again.
Do I need to understand GitHub to use this feature?
Do I need to understand GitHub to use this feature?
Not at all! If you just want a backup copy of your code, follow the steps above and you’re done. GitHub will store your code safely. You only need to learn GitHub’s features if you want to do more advanced things like branching or collaborating with other developers.
Can I disconnect from GitHub later?
Can I disconnect from GitHub later?
Yes, you’ll find the option to disconnect the repository inside of the project settings in the GitHub page. Please note that this won’t work if Lovable can’t establish the connection to the repo, because of changes made to repo path, username etc.
Can I import an existing GitHub repository into Lovable?
Can I import an existing GitHub repository into Lovable?
Currently, Lovable does not support directly importing or linking to an existing external GitHub repo as a new project. In other words, you can’t point Lovable at an existing repository and have it pull in all that code automatically.
How do I switch the GitHub account linked to my Lovable account if I connected the wrong one?
How do I switch the GitHub account linked to my Lovable account if I connected the wrong one?
Unfortunately, you cannot switch the GitHub account once it’s been connected to a Lovable account.
The repo is in the wrong organization or location, can I move it?
The repo is in the wrong organization or location, can I move it?
No, this is not directly possible. However, there is one workaround.
- Remix the Project: Create an exact copy of the project by remixing it from the project settings. This copy won’t be connected to GitHub.
- Connect the New Project: In the remixed project, follow the steps to connect to GitHub.
- Select the Correct Organization: During the connection process, choose the correct organization.
I am getting the error message Lovable can't access your repository. What should I do?
I am getting the error message Lovable can't access your repository. What should I do?
The issue is most likely that you’ve changed something in your GitHub repository setup causing Lovable not being able to find the repository in the same location.
Undo any changes to your username, repository name, organization name, repository path or restore the repository if it has been deleted and the project should work again.
Why aren’t my commits showing up in Lovable?
Why aren’t my commits showing up in Lovable?
The most common reason is that the commits were made on a branch that Lovable isn’t tracking. Lovable only syncs with the repository’s default branch (usually main). To fix this, merge the branch into the default branch or switch branch inside of Lovable