No-CodeIntermediate

How to Export a Lovable App to GitHub and Run It Locally

Sync your Lovable project to a GitHub repo, clone it, and run the dev server on your own machine for full control.

8 minIntermediate

No-code tools are not a cage. Lovable can sync your whole project to a GitHub repository, which means you own the code and can run, edit, or deploy it anywhere. This guide connects GitHub, clones the repo, and gets the app running locally.

What you need

  • A Lovable project you want to export
  • A GitHub account
  • Git and Node 18+ installed on your computer
  • About 15 minutes

Step 1: Connect GitHub in Lovable

Open your project, click the GitHub button in the top bar, and authorize Lovable. It creates a new repository under your account (or an organization you choose) and pushes the current code.

Lovable - GitHub sync
Connect to GitHub
------------------------------------------
Owner: your-username
Repo: prep-pilot (new, private)
Two-way sync: edits in Lovable push here,
and commits here pull back into Lovable.
[ Create repository ]
Lovable creates and keeps a repo in sync with your project.

Step 2: Clone the repo locally

Copy the repo URL from GitHub and clone it to your machine. This gives you the exact files Lovable generated, including package.json and the Vite or Next config.

zsh - clone
$git clone https://github.com/your-username/prep-pilot.git
Cloning into 'prep-pilot'...
$cd prep-pilot && npm install
added 271 packages in 9s
$

Step 3: Add environment variables

If the app uses Supabase or any API, it needs the keys at runtime. Lovable does not commit secrets to the repo, so create a local .env file with the values from your Supabase project settings.

.env
VITE_SUPABASE_URL=https://abcxyz.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6...

Step 4: Run the dev server

Start the app locally. It should behave exactly as it did in the Lovable preview, but now you can edit any file with your own editor and tools.

zsh - dev
$npm run dev
VITE ready in 380 ms
Local: http://localhost:5173/
$
Keep editing in one place at a time
The sync is two-way, so a change in Lovable and a conflicting change in your local clone can collide. Decide where you are editing for a given session, push or pull first, and avoid editing both at once.

Result

You now have the full source on GitHub and a working local copy. You are free to add your own libraries, run tests, or deploy to any host, while still using Lovable for fast AI-driven changes.

Watch related tutorials

Tags
#lovable#github#git#export#local