---
title: GitHub
description: Connect your GitHub repositories to v0 to automatically create projects and track changes.
product: v0
type: integration
prerequisites:
  - /docs/quickstart
related:
  - /docs/git-import
  - /docs/vercel-integration
  - /docs/projects
---

# GitHub



v0 allows you to connect your chats with GitHub for:

* **Version Control:** Track and revert code changes
* **Collaboration:** Work on the same codebase together
* **CI/CD:** Deploy automatically when pushing to Git
* **Pull Requests:** Review changes before merging

<Callout>
  **Plus plans:** By default, team members must have access to a GitHub
  repository to collaborate on its associated chat and generate previews. To
  allow members without GitHub access to participate, enable **Allow v0 to Act
  on Behalf of Members** in your [workspace
  settings](https://v0.app/chat/settings/workspace). See [Teams → GitHub
  repository access](/docs/teams#github-repository-access) for details.
</Callout>

## How v0 works with Git

When you connect a chat to GitHub, v0 creates a working branch from a base branch. This keeps changes isolated until you open and merge a pull request.

* **Automatic branching:** v0 creates a dedicated branch (for example, `v0/username-abc123`) for each chat
* **Auto-commits:** Every message you send that changes code automatically creates a commit
* **Isolated changes:** v0 commits generated changes to the chat's working branch instead of pushing them directly to its base branch
* **Merge when ready:** When you're done, create a PR targeting the base branch and merge your changes

Three branch settings can be involved:

| Branch                | How v0 uses it                                                                                                                                                                                   |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Default branch**    | The repository's default branch on GitHub. v0 selects it initially when you import an existing repository. A repository created by v0 uses the GitHub owner's configured default branch name.    |
| **Base branch**       | The branch selected when the chat is connected or imported. v0 creates the working branch from it and targets it when opening a pull request.                                                    |
| **Production branch** | The branch configured on the linked Vercel project to create production deployments. It is often the default or base branch, but it can be different. Other branches create preview deployments. |

<Callout>
  If you used v0's previous Git integration, the new workflow is fully
  automatic. No manual commits or branch management needed.
</Callout>

## Connecting to GitHub

<Callout type="warning">
  **Important:** Once a GitHub repository is connected, it becomes the source of
  truth for your project. v0 does not store a separate copy of your code. If the
  repository is deleted from GitHub, your code may become unrecoverable.
</Callout>

<Image
  alt="Connecting a chat to GitHub"
  src="/docs/light/connectrepolight.gif"
  srcDark="/dark/connectrepodark.gif"
  width={600}
  height={338}
  style={{
    width: '100%',
    height: 'auto',
    maxWidth: 600,
    aspectRatio: '600 / 338',
  }}
/>

To connect your chat to GitHub:

1. In the **sidebar panel**, click on the **Git** section.
2. Click **Connect** to start the connection process.
3. In the **Create Repository** modal, select your **Git Scope** (the GitHub account or organization) and enter a **Repository Name**.
4. Click **Create Repository** to link your chat to a new private GitHub repository.

<Callout>
  You can also manage your GitHub connection from the **Project Menu** `...` in
  the same top right of the chat UI.
</Callout>

### Importing an existing repository

To start from an existing repository, use [Git Import](/docs/git-import). Choose the branch v0 should use as the base, then either link an existing Vercel project or create a new Vercel project for the import.

Importing does not duplicate the repository on GitHub. It creates a v0 chat and a working branch in the selected repository. Importing the same repository again creates another chat and working branch; it does not create another GitHub repository. You can link the import to the same Vercel project or create a separate Vercel project.

Once connected, you'll see information about your repository including:

<Image
  alt="GitHub repository status card"
  src="/docs/light/statusghlight.png"
  srcDark="/dark/statusghdark.png"
  width={600}
  height={338}
  style={{
    width: '100%',
    height: 'auto',
    maxWidth: 600,
    aspectRatio: '600 / 338',
  }}
/>

* **Branch:** The current working branch (for example, `v0/username-e7bad8e4`)
* **Merges into:** The base branch that a pull request will target
* **Status:** Whether your branch is up to date
* **PR:** The status of any open pull request
* **Activity:** A timeline of changes and commits

## Creating a Pull Request

When you're ready to merge your changes:

1. Click the **Publish** button (which now shows a PR icon when connected to GitHub).
2. Select **Open PR** to create a pull request from your working branch to its base branch.
3. The publish modal will update to show your open PR with options to **View PR** or **Merge PR**.

<Image
  alt="Publishing a PR and merging"
  src="/docs/light/mergedlight.gif"
  srcDark="/dark/mergedblack.gif"
  width={600}
  height={338}
  style={{
    width: '100%',
    height: 'auto',
    maxWidth: 600,
    aspectRatio: '600 / 338',
  }}
/>

## Merging and continuing work

After merging your PR:

1. Your current chat branch is merged into its base branch.
2. To continue working, click **New Chat** to create a new branch.
3. Each new chat acts as a new feature branch where you can make changes.
4. When ready, create another PR and repeat the process.

If the base branch is also the linked Vercel project's production branch, merging it triggers a production deployment. If they differ, the merge follows the Vercel project's configured branch behavior.

## Creating branches

v0 supports flexible branching workflows:

* **Branch from the base:** Create a new chat to start a fresh working branch from the connected base branch
* **Branch from a working branch:** Click the branch name in the chat header and select **Duplicate Branch...**

<Image
  alt="Creating a branch from a branch"
  src="/docs/light/branchlight.gif"
  srcDark="/dark/branchdark.gif"
  width={600}
  height={338}
  style={{
    width: '100%',
    height: 'auto',
    maxWidth: 600,
    aspectRatio: '600 / 338',
  }}
/>

For a Git-connected chat, **Duplicate Branch** creates a new chat and branch containing the current branch's commits. The new branch stays in the same GitHub repository, keeps the same Vercel project and configuration, and targets the same base branch for pull requests.

The destination choice applies only when duplicating a chat that is not connected to GitHub:

* **Vercel project only:** Continue with the same Vercel project and configuration, or create a new project without carrying the connection over.
* **No GitHub or Vercel project:** The duplicate starts as a new project.


---

For a semantic overview of all documentation, see [/docs/sitemap.md](/docs/sitemap.md)

For an index of all available documentation, see [/docs/llms.txt](/docs/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/docs/agents.md](/docs/agents.md)