---
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>
  **Team 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](/teams#github-repository-access) for details.
</Callout>

## How v0 works with Git

When you connect a chat to GitHub, v0 automatically creates a branch off `main` for you to work on. This keeps your `main` branch protected while you iterate.

* **Automatic branching:** v0 creates a dedicated branch (e.g., `v0/main-abc123`) for each chat
* **Auto-commits:** Every message you send that changes code automatically creates a commit
* **Protected main:** v0 never pushes directly to `main`, so your production code stays safe
* **Merge when ready:** When you're done, create a PR and merge your changes

This means you can focus on building without worrying about Git commands or accidentally breaking your main branch.

<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="/light/connectrepolight.gif" srcDark="/dark/connectrepodark.gif" width={600} height={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 **Settings** section in the same in-chat panel.
</Callout>

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

<Image alt="GitHub repository status card" src="/light/statusghlight.png" srcDark="/dark/statusghdark.png" width={600} height={338} />

* **Branch:** The current working branch (e.g., `v0/main-e7bad8e4`)
* **Merges into:** The target branch for merging (typically `main`)
* **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 `main`.
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="/light/mergedlight.gif" srcDark="/dark/mergedblack.gif" width={600} height={338} />

## Merging and continuing work

After merging your PR:

1. Your current chat branch is merged into `main`.
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.

## Creating branches

v0 supports flexible branching workflows:

* **Branch from main:** Create a new chat to start a fresh branch off `main`
* **Branch from a branch:** Click the branch name in the chat header, select **Duplicate Branch...**, then choose whether to continue in the same project or start a new one

<Image alt="Creating a branch from a branch" src="/light/branchlight.gif" srcDark="/dark/branchdark.gif" width={600} height={338} />

When duplicating a branch, you can:

* **Continue chatting in the same project:** Keeps the Vercel project connection, integrations, environment variables, and deployments
* **New Project:** Starts fresh without carrying over the existing configuration

<Callout>
  Enhanced branch creation features are coming soon, giving you more control over your branching workflow.
</Callout>
