---
sidebar_position: 1
title: GitHub Integration
---

# GitHub Integration

Connect your GitHub repositories so Zibby can analyze your codebase and create pull requests from AI-generated code.

## How It Works

Zibby uses a **GitHub App** to access your repositories. The app requests read access to your code and write access to create pull requests.

When you run an analysis, Zibby:

1. Clones the repository into a secure container
2. Analyzes the codebase alongside the Jira ticket
3. Generates code changes as a diff
4. Optionally creates a pull request with the suggested changes

## Connect GitHub

1. Go to your project's **Settings** page in the Zibby dashboard
2. Under **Integrations**, click **Connect GitHub**
3. You'll be redirected to GitHub to install the Zibby App
4. Select the repositories you want to grant access to
5. Click **Install & Authorize**
6. You'll be redirected back to Zibby

## Permissions

The Zibby GitHub App requests:

| Permission | Level | Purpose |
|---|---|---|
| Repository contents | Read | Clone and analyze your code |
| Pull requests | Write | Create PRs from generated code |
| Metadata | Read | List repositories |

## Select Repositories

After connecting, go to **Settings > Repositories** to select which repos are available for analysis. You can choose:

- **Primary repository** — the main codebase for analysis
- **Additional repositories** — supporting repos that provide context

## Creating Pull Requests

After an analysis generates code changes:

1. Go to the **Analysis** page for the ticket
2. Review the code diff in the **Code Changes** tab
3. Click **Create Pull Request**
4. Zibby creates a PR on your repository with the suggested changes
5. Review and merge through your normal GitHub workflow

## Token Management

Zibby uses GitHub App installation tokens that automatically refresh. You don't need to manage tokens manually. If you need to reconnect:

1. Go to **Settings > Integrations**
2. Click **Disconnect** next to GitHub
3. Click **Connect GitHub** to re-authorize

## Troubleshooting

**"Repository not found" during analysis**

Make sure the repository is selected in your project settings and the GitHub App has access to it.

**"Permission denied" when creating PR**

Verify the GitHub App installation has write access to pull requests for the target repository.
