> For the complete documentation index, see [llms.txt](https://help.genesis.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.genesis.autify.com/resources-context/github-integration.md).

# GitHub integration

This article explains the **GitHub Integration** feature. By connecting GitHub repositories, you can sync code from selected repositories automatically or manually, allowing the AI to reference the code when answering questions or running workflows.

## Prerequisites

| Action                        | Required role |
| ----------------------------- | ------------- |
| Connect GitHub repositories   | Admin / Owner |
| Select or change repositories | Admin / Owner |
| Change the branch to sync     | Admin / Owner |
| Manual sync                   | Admin / Owner |
| Change sync settings          | Admin / Owner |
| Disconnect GitHub             | Admin / Owner |

## Connecting a GitHub repository

<figure><img src="/files/81lQq40eFeYpaatK7rvL" alt="Screenshot of the GitHub repository connection screen"><figcaption><p>GitHub repository connection screen</p></figcaption></figure>

1. On the workspace page, select the **Resources and Context** tab.
2. Select **Codebase**.
3. On the GitHub card, click **Connect GitHub**.
4. When the GitHub app installation screen appears, choose the organization to install the Genesis app on and select the repositories to grant access to, then install the app.
5. After returning to Genesis, click **Select repositories**.
6. Select the repositories to sync.
7. Click **Save changes**.

## Selecting or changing repositories

After GitHub is connected, you can add or change repositories to sync. If you unselect a repository, the corresponding codebase is automatically deleted.

<figure><img src="/files/vHF0qj7CkAtQe0LsjT7h" alt="Screenshot of the repository selection screen"><figcaption><p>Repository selection screen</p></figcaption></figure>

1. On the workspace page, select the **Resources and Context** tab.
2. Select **Codebase**.
3. In the **Selected repositories** section, click **Edit**.
4. Select or unselect repositories to sync.
5. Click **Save changes**.

## Changing the branch to sync

You can change the branch to sync for each connected repository. If no branch is specified, the repository's default branch is synced.

<figure><img src="/files/SV9Ffbtxm7QEBOgRFQpT" alt="Screenshot of the branch selector"><figcaption><p>Branch selector</p></figcaption></figure>

1. On the workspace page, select the **Resources and Context** tab.
2. Select **Codebase**.
3. In the **Selected repositories** section, click the button showing the current branch name on the target repository's row.
4. Select a branch from the list. You can filter by branch name using the search box.

## Running manual sync

Manually update GitHub repository content to the latest state.

<figure><img src="/files/zYgUv6kFuKhqWU6fAWrQ" alt="Screenshot of the manual sync button"><figcaption><p>Manual sync button</p></figcaption></figure>

1. On the workspace page, select the **Resources and Context** tab.
2. Select **Codebase**.
3. On the GitHub card, click **Sync**.

## Changing sync settings

In addition to manual sync, you can configure sync triggered by push/commit events or scheduled sync at a specified cadence.

<figure><img src="/files/ESOc9RWMtC7DBn17gOPa" alt="Screenshot of the sync settings dialog"><figcaption><p>Sync settings dialog</p></figcaption></figure>

1. On the workspace page, select the **Resources and Context** tab.
2. Select **Codebase**.
3. In the **Sync settings** section, click **Configure**.
4. Choose the sync timing.
   * **Manual sync**: Sync only when manually triggered.
   * **Trigger sync on push/commit**: Automatically sync when code is pushed to the selected branch.
   * **Enable automatic sync**: Sync periodically at the specified cadence and time. Choose a **Frequency** (Daily / Weekly / Monthly) and **Time**. For **Weekly**, also specify the **Day of week**; for **Monthly**, also specify the **Day of month**.
5. Click **Save**.

## Disconnecting GitHub

<figure><img src="/files/xPQMBlKK6BMJCP42Z1i1" alt="Screenshot of the GitHub disconnect menu"><figcaption><p>GitHub disconnect menu</p></figcaption></figure>

1. On the workspace page, select the **Resources and Context** tab.
2. Select **Codebase**.
3. On the GitHub card, click the **menu** (<img src="/files/LcbwQkXW0dl3jAZZqltK" alt="" data-size="line">) at the right end.
4. Click **Disconnect**.

## Troubleshooting

### GitHub integration errors

| Situation                                            | Cause                                                     | Resolution                                                               |
| ---------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------ |
| Authentication from **Connect GitHub** fails         | Insufficient GitHub account permissions, or access denied | Check your GitHub account permissions and try connecting again.          |
| "Failed to sync repository" appears                  | Network error or temporary GitHub API issue               | Click **Sync** again to retry manual sync.                               |
| Message indicates that a sync is already in progress | Another sync is running                                   | Wait for the current sync to complete and retry.                         |
| "Failed to disconnect GitHub" appears                | Network error or temporary server issue                   | Reload the page and try again.                                           |
| "Failed to load GitHub installations" appears        | Failed to fetch GitHub integration data                   | Reload the page. If the issue persists, disconnect GitHub and reconnect. |
| "Failed to delete code archive" appears              | An error occurred during deletion                         | Reload the page and try again.                                           |
| "Failed to load branches" appears                    | Failed to fetch the repository's branch list              | Reload the page. If the issue persists, disconnect GitHub and reconnect. |
| "Failed to update branch" appears                    | Network error or temporary server issue                   | Wait and try again.                                                      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.genesis.autify.com/resources-context/github-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
