Step-by-Step Guide

Connect Your Lovable Project to GitHub

Built something awesome with Lovable? Get it on GitHub in under 5 minutes. Enable backups, collaboration, and security scanning for your AI-generated code.

Why Bother?

4 Reasons to Connect to GitHub

Lovable is great for building fast, but GitHub unlocks the full potential of your project.

Secure Backup

Your code is safely stored on GitHub, protected from accidental loss. Never lose your work again.

Team Collaboration

Share your project with teammates, accept contributions via pull requests, and work together seamlessly.

Security Scanning

Enable tools like CursorGuard to scan your codebase for vulnerabilities and keep your app secure.

Local Development

Clone your repo and work in VS Code, Cursor, or any IDE. Push changes back and they'll sync to Lovable.

The Guide

6 Easy Steps to GitHub

Follow along and you'll have your Lovable project on GitHub in no time.

1

Go to Settings → Connectors → GitHub

In your Lovable project, navigate to Settings, then find the Connectors section, and select GitHub. This is where all the GitHub integration options live.

Pro Tip

Make sure your project is in a stable state before connecting—any unsaved changes should be committed first.

2

Click "Connect GitHub"

Click the "Connect GitHub" button to start the OAuth flow. You'll be redirected to GitHub to sign in and authorize the connection between Lovable and your GitHub account.

Pro Tip

If you don't see the GitHub option, make sure you're on a paid plan—some features may be limited on free tiers.

3

Install the Lovable GitHub App

GitHub will prompt you to install the Lovable GitHub App on your account or organization. Choose whether to give access to all repositories or only specific ones.

Pro Tip

Lovable needs repository write access to sync your code. This is safe and standard for integration apps.

4

Connect Your Project to a Repository

Back in Lovable, select which project to connect. Lovable can create a new repository for you, or you can connect to an existing one. Give it a meaningful name.

Pro Tip

Use a clear, descriptive name like "my-saas-app" rather than "lovable-project-1". You'll thank yourself later!

5

Verify the Sync is Working

Once connected, make a small change in Lovable and check your GitHub repo. You should see a new commit appear within seconds. The sync is bidirectional on the main branch only.

Pro Tip

Check the GitHub repo's commit history to confirm changes are flowing through.

6

Connect to CursorGuard

Now that your code is on GitHub, head to CursorGuard to run your first security scan. Connect your GitHub account and select your newly synced repository.

Pro Tip

CursorGuard's free tier includes 1 scan per month—perfect for getting started!

The Big Picture

How It All Connects

Lovable

Your AI Builder

GitHub

Your Code Home

CursorGuard

Security Scanning

Changes sync automatically between Lovable and GitHub. CursorGuard scans your GitHub repo on every push.

Troubleshooting

Common Issues & Fixes

Hit a snag? Here are solutions to the most common problems.

Sync stopped working after force-push

Solution

Lovable's sync can break if you rewrite Git history with force-push. Avoid using `git push --force` on synced repositories. If already broken, try disconnecting and reconnecting the GitHub integration.

Changes on branches aren't syncing

Solution

Lovable only syncs the main/default branch by default. Work on feature branches in GitHub, then merge to main for changes to appear in Lovable. There's an experimental "GitHub branch switching" feature in Lovable Labs that may allow working on other branches.

Can't find my organization in the dropdown

Solution

You may need to grant the Lovable GitHub App access to your organization. Go to GitHub Settings → Applications → Lovable and add organization access.

Preview not updating after GitHub changes

Solution

Sometimes there's a delay in syncing. Wait a few seconds and refresh. If it persists, check that you're editing the main branch and that the Lovable integration is still connected.

Repository was renamed or moved

Solution

Renaming or moving your GitHub repository can break the Lovable sync. You may need to disconnect and reconnect the integration, pointing to the new location.

Important: Things to Avoid

  • Don't force-push — It rewrites history and breaks Lovable's sync
  • Don't rename your repo — Lovable loses track of the connection
  • Stick to the main branch — Other branches won't sync back to Lovable

Alternative: Download Without GitHub

If you're on Lovable's Business plan, you can download your entire codebase as a ZIP file directly. There's also a community Chrome extension called "Lovable Project Downloader" that lets you export your project without needing GitHub at all. However, GitHub is still recommended for version control and enabling security scanning tools like CursorGuard.

Connected to GitHub?

Now Secure Your AI-Generated Code

You've done the hard part. Now let CursorGuard scan your Lovable project for security vulnerabilities, authentication issues, and common AI coding mistakes.

Free tier includes 1 scan/month. No credit card required.