> ## Documentation Index
> Fetch the complete documentation index at: https://lovable.generaltranslation.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your project to GitHub

> Learn how to connect, sync, and disconnect your Lovable project to GitHub for code backup, collaboration, and deployment.

When you build with Lovable, your code lives inside the Lovable platform — perfect for most creators.

If you want your own copy, plan to collaborate with developers, or move your project elsewhere, you can export and sync everything to GitHub in just a few clicks.

## About GitHub

GitHub is a cloud-based platform for storing, managing, and sharing code. It keeps track of every change, supports collaboration, and integrates with popular deployment tools like Vercel and Netlify. Think of it as **Google Drive for code**, built for developers.

## Why connect Lovable to GitHub

Connecting your Lovable project to GitHub lets you:

* **Back up your code:** Store your project safely outside Lovable.
* **Collaborate easily:** Invite developers, use pull requests, branches, and code reviews.
* **Sync automatically:** Edits in Lovable appear in GitHub, and changes in GitHub sync back on the default branch (`main`).
* **Work locally:** Clone, edit, and commit in your IDE while keeping your project synced.
* **Deploy anywhere:** Self-host or deploy to alternative platforms, see [Self-hosting: Run your Lovable Cloud project anywhere](/tips-tricks/self-hosting).
* **Test safely:** Enable experimental **GitHub branch switching** in **Settings → Account → Labs** to develop features before merging changes to your live project. See [Labs](/features/labs) for more information.

<Note>
  You don’t need GitHub to use Lovable — many users build and launch entirely within Lovable.
</Note>

## Before you connect

Make sure you understand how the integration works:

* **GitHub account required:** Create one for free at [github.com](http://github.com).
* **Single source of truth:** When connected, your code lives in GitHub, not separately in Lovable.
* **Two-way sync:** Edits in Lovable appear in GitHub, and vice versa.
* **Stable repo path:** The connection depends on the exact GitHub repository name, location, organization, and account.

<Warning>
  Don’t rename, move, or delete your GitHub repository after connecting. Doing so will break the sync, and Lovable won’t be able to update your project.
</Warning>

## Set up the GitHub integration

Only workspace **admins and owners** can manage the GitHub integration — adding accounts and organizations, and connecting or disconnecting projects.

Connecting GitHub happens in three stages:

1. **Link your GitHub account** (OAuth authorization)
2. **Install the Lovable GitHub App** on an account or organization
3. **Connect individual projects** to repositories

### Step 1: Connect your GitHub account

This step links your GitHub identity to Lovable through OAuth authorization.

1. Go to **Settings → Integrations → GitHub.**
2. Click **Connect GitHub**.
3. Sign in to your GitHub account or **authorize lovable.dev** to verify your GitHub identity.\
   You then see an option to connect a project.

### Step 2: Install the Lovable GitHub app

This step installs the **Lovable GitHub App** on your GitHub account or organization and grants permission for Lovable to create and update repositories there.

You can install the app under your personal GitHub account or any organization where you have admin access.

1. Go to **Settings → Integrations → GitHub.**
2. Click **Connect project.**
3. Click **Add organizations** and choose where to **install and authorize lovable.dev** — your personal account or one of your organizations.
4. Select whether to give access to **all repositories** or **only selected ones**.
5. Click **Install & Authorize** to grant Lovable permission to create and update repositories in your chosen account or organization.

### Step 3: Connect a project to GitHub

This step links a specific Lovable project to a GitHub repository. Each Lovable project can have **one linked repository**.

1. Go to **Settings → Integrations → GitHub** and click **Connect project**, or click the GitHub icon in the top-right corner of your project and click **Connect GitHub**.
2. Choose the GitHub organization or account where your code should live.
3. Click **Transfer anyway** to confirm transfer and set up a 2-way sync.\
   A new GitHub repository is created for your project, and sync begins automatically.

## Disconnect your project from GitHub

Workspace admins and owners can disconnect projects from GitHub at any time in the project’s GitHub settings.

When you disconnect:

* **Sync stops:** The two-way connection between Lovable and GitHub ends.
* **Your repository stays on GitHub:** It remains intact with all history and files.
* **Your code stays in Lovable:** Future changes are stored only inside Lovable.

If you reconnect later:

* A **new GitHub repository** is created using your latest Lovable code.
* Your **original repository** stays on GitHub but is no longer linked to Lovable.

<Note>
  You can’t disconnect a project if Lovable can’t reach the GitHub repository (for example, if it was renamed, moved, or deleted).
</Note>

## FAQ

<AccordionGroup>
  <Accordion title="Do I need to know GitHub to use this feature?">
    No. Just connect and authorize — GitHub will safely store your code. 

    You only need to learn GitHub’s features if you want to do more advanced things like branching or collaborating with other developers.
  </Accordion>

  <Accordion title="Clicking 'Connect GitHub' does nothing — what’s wrong?">
    Your browser probably blocked the GitHub login popup. Allow popups for Lovable, then try again.
  </Accordion>

  <Accordion title="What happens if I rename, move or delete my GitHub repository?">
    The connection will break. 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 original name. If deleted, you can [restore it on GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/restoring-a-deleted-repository).
  </Accordion>

  <Accordion title="What happens if I rename my GitHub username or organization?">
    The connection will break. Your project will stop syncing, and you won’t be able to edit it in Lovable.

    To fix this, revert to the original GitHub user or organization name.
  </Accordion>

  <Accordion title="How can I switch to a different GitHub account?">
    You can’t change the linked GitHub account once connected.
  </Accordion>

  <Accordion title="The repo ended up in the wrong organization — can I move it?">
    Not directly. Try this workaround:

    1. **Remix your project** to create a new copy.
    2. **Connect the new project** to GitHub.
    3. Choose the correct organization during setup.
  </Accordion>

  <Accordion title="Lovable can’t access my repository — what should I do?">
    You’ve likely renamed, moved, or deleted the repo. Restore or revert any changes to the repo’s name, path, or owner, or [restore](https://docs.github.com/en/repositories/creating-and-managing-repositories/restoring-a-deleted-repository) the repository if it has been deleted and the project should work again.
  </Accordion>

  <Accordion title="Can I disconnect from GitHub?">
    Yes. Admins and owners can disconnect projects from GitHub at any time in your project’s GitHub settings. Your repository stays on GitHub, but syncing stops. If you reconnect later, a new repository is created.
  </Accordion>

  <Accordion title="Can I import an existing GitHub repo into Lovable?">
    No. You can only export from Lovable to GitHub, not the other way around.
  </Accordion>

  <Accordion title="Why don’t my commits appear in Lovable?">
    Lovable only syncs the **default branch** (usually `main`). Merge your branch into `main` or [switch branches](/features/labs) inside Lovable.
  </Accordion>
</AccordionGroup>
