> ## Documentation Index
> Fetch the complete documentation index at: https://www.magicpatterns.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect a GitHub repo

> Connect a GitHub repo so the agent can build using your real code.

Connect a GitHub repo so the agent can read your components, styles, and patterns, and build designs that look like your real product.

Magic Patterns only reads your repo. It never changes your code.

Connecting a repo doesn't import a design system. To import one, see [Choose how to import](https://www.magicpatterns.com/docs/documentation/design-systems/importing/overview.md).

## Connect a repo

**1. Open the GitHub option.**

When you open a new project, choose **Connect a GitHub repo**.

![The start screen with the Connect a GitHub repo option](https://cdn.magicpatterns.com/uploads/ogVuF6MiMnEvJeTr8iA8GW/connect_a_github_repo.png)

**2. Connect your GitHub account.**

The first time you do this, click **Connect GitHub**. You only need to do this once.

![The Connect your GitHub account window](https://cdn.magicpatterns.com/uploads/5cqQQVmBwFddGhTrPm2FXV/connect_github.png)

**3. Authorize Magic Patterns.**

A GitHub window opens. Click **Authorize**.

![The GitHub window asking to authorize Magic Patterns](https://cdn.magicpatterns.com/uploads/nYXtWMSWWo8qEUPkFsb7W5/authorize.png)

**4. Find your repo.**

Search for it by name, or paste its URL, like `https://github.com/your-org/your-repo`. By default (after authorizing), your repo should appear.

![A selected repository with branch and subfolder options](https://cdn.magicpatterns.com/uploads/v2CuDsL5SZ3SrxqP63q8wd/add_a_repository.png)

**5. Choose a branch.**

The main branch is selected by default. To use a different one, pick it from the **Branch** menu.

**6. Choose folders (optional).**

Select only the folders or files the agent needs, like your components folder or style guide. For large repos, this keeps the agent focused.

![The Add a GitHub repository window with a search bar](https://cdn.magicpatterns.com/uploads/udFCpUGXxeoE2qeTGnq4sn/select_repository.png)

**7. Click Link.**

The agent can now read your code while it builds. Next time, you'll skip steps 2 and 3 because your GitHub account stays connected.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.