# GitHub repository

> The card an Agent sends in chat when it needs a GitHub repository: grant access on GitHub, or choose a repository to share, and what older GitHub cards say.

Source: https://air.build/docs/cards/request-github-repo/

A GitHub repository card is an Agent asking for a GitHub repository it can't reach yet. It names what it needs, either one repository, a whole GitHub account, or a repository of your choice, and has one button that takes you to GitHub or to a list of your repositories.

> [!NOTE]
> Agents send this as the `request_github_repo` card.

## Who sends it and who answers

An Agent sends it into the chat it's working in. A Team's Agents use the GitHub connection of the Team's owner, so the card is for the owner: only what the owner connects and grants answers it. If you're a member of someone else's Team, tapping the button doesn't open GitHub. Ask the Team's owner to finish it. See [Connect your GitHub account](https://air.build/docs/team/connect-github-account/).

While it's waiting, the card counts in the **Unanswered** chip above the message box, until you've sent a message after it or scrolled to it.

## What's on the card

The card has the GitHub mark and the title **GitHub**. The line under the title and the button depend on what the Agent asked for:

| The Agent asks for | The card says | Button |
| --- | --- | --- |
| One repository | "Needs access to the repository _owner/repo_. Grant it to the AirBuild app on GitHub." | **Grant Access** |
| A whole GitHub account | "Needs access to repositories on the _account_ account. Install the AirBuild app on GitHub and choose which repositories to share." | **Grant Access** |
| A repository you choose | "Choose a GitHub repository to share." | **Choose Repository** |

The Agent's name is on the message above the card.

## Grant access

1. Tap **Grant Access**. The button shows a spinner while the app checks your GitHub connection.
2. If your GitHub account isn't connected yet, sign in to GitHub first. On iPhone and iPad the sign-in opens in a sheet inside the app; on the Mac it opens in your web browser.
3. If the repository is already granted, the card is answered at once and nothing opens.
4. Otherwise GitHub's page for the AirBuild GitHub App opens in your browser. Grant the repository (or install the app on the account and choose repositories) there.
5. Come back to AirBuild. The app keeps checking for a while after you tap the button and when you return, and the card turns to "Access granted to" the repository as soon as GitHub has the grant. You don't need to tap anything else.

If you closed GitHub's page by mistake, tap **Grant Access** again; it opens the page again.

If the repository belongs to an organization that uses single sign-on, tapping **Grant Access** signs you in to GitHub again so you can complete single sign-on when GitHub asks. If your GitHub sign-in has expired, the button starts the sign-in again.

## Choose a repository

1. Tap **Choose Repository**. If your GitHub account isn't connected yet, sign in to GitHub first.
2. The [Share Repository](https://air.build/docs/screens/chat/share-repository/) sheet opens. Pick the account and the repository.
3. Tap **Share**. The sheet closes and the card is answered.

## After it's answered

The GitHub mark becomes a check mark, the button goes away, and the card says **Access granted to** and the repository (or account). If the app doesn't know which one, it says **Access granted**.

## What the Agent gets back

That access was granted, and, on a card where you chose, the repository you shared as _owner/repo_.

## Older GitHub cards

Earlier versions of AirBuild drew two other GitHub cards. They're no longer shown as cards. Where one is in a chat, the message reads:

"This request is out of date. The agent will send a new one if it still needs GitHub access."

Nothing needs doing. If the Agent still needs access, it sends a new GitHub repository card.

Older Agents sent an older version of this card.

## Messages

| Message | What it means | What to do |
| --- | --- | --- |
| "This request is out of date. The agent will send a new one if it still needs GitHub access." | In place of an older GitHub card. | Nothing; wait for a new card if the Agent still needs access. |
| "Access granted to _owner/repo_" | The card is answered. | Nothing. |
| "Ask the owner to finish this step on GitHub." | Only the Team's owner can do this step. | Ask the Team's owner to answer the card. |
| "This organization uses single sign-on. Choose Grant Access again and complete single sign-on when GitHub asks." | The repository's organization uses single sign-on, and the sign-in AirBuild started didn't get you through it. | Tap **Grant Access** again and complete single sign-on when GitHub asks. |

Errors while choosing a repository show on the [Share Repository](https://air.build/docs/screens/chat/share-repository/#messages) sheet.
