# Import a repository

Import a GitHub repository to turn it into a Sensei project. In the sidebar, hover the workspace's row and press its **+**, pick **Import from GitHub** if the dialog shows tabs, pick the repository and press **Import Repository**. To start a new one from a sentence instead, where your deployment offers it, see [Start from kosuke-starter](https://kosuke.ai/docs/set-up/preview-and-publish.md#start-from-kosuke-starter). In Sensei, **Import** in Get started does the same for the workspace from your sign-up. The first time, the same dialog asks you to install the Kosuke App on GitHub, which connects your GitHub account in the same trip.

Any member of a workspace can import a repository into it, when their own GitHub account can write to that repository. Read access is not enough: every project pushes to its repository. Importing starts the project's first deploy. A workspace deploy uses workspace Credentials only. Without usable Credentials, it waits for a workspace admin to fix them. Personal-project deploys follow the personal owner's Deploy model choice, or the first connected provider in catalog order and its catalog default model when unset. See [Deploy your project](https://kosuke.ai/docs/set-up/deploy.md#before-you-deploy).

## Import the repository

1. In the sidebar, hover the workspace's row and press its **+**. In the iOS app and in a narrow window the **+** always shows. The New repository dialog opens. Pick its **Import from GitHub** tab. **Import a repository** in the workspace's **…** menu opens it too. So does the **Import repository** row of a workspace with no projects, and **Add a project** on its Overview. In Sensei, **Import** in Get started opens it for the workspace from your sign-up. The dialog has no workspace picker. It imports into the workspace you opened it for.
2. If the dialog reads "Connect your repositories", press **Install on GitHub**. On GitHub, pick the account and the repositories the Kosuke App may see, then authorize it. GitHub sends you back to the same dialog with your repositories listed. If your GitHub organization already has the app, press **Connect GitHub** under the button instead.
3. Open the Repository list. Type to search.
4. If your repository is greyed out, press **Install App** beside it and add the repository on GitHub. GitHub sends you back to the dialog.
5. Select the repository and press **Import Repository**.

An imported repository starts with Merge mode **Off**. It opens on Settings until its first deploy lands, then on Preview. Turn on the [Merge agent](https://kosuke.ai/docs/set-up/project-settings.md#merge-agent) later in Settings.

![The Import Project dialog open over a project board. It reads "Choose a GitHub repository to import" and holds a Repository list set to "Select a repository", a link reading "Can't find your repository? Configure the Kosuke GitHub App", and an Import Project button.](https://kosuke.ai/docs/img/import-project.webp)

## Connect GitHub

Your GitHub Connection links your own GitHub account to Sensei. It belongs to you and follows you into every workspace you join. Sensei uses it to list the repositories you can reach and to put your name on the commits and pull requests from your messages.

You can connect from the import dialog or from Settings > You > Integrations. In the dialog, **Install on GitHub** installs the Kosuke App and connects you in one trip, and **Connect GitHub** under it connects you without installing, for a GitHub organization that already has the app. Settings connects without installing. The GitHub row there shows your GitHub username once you are connected.

| You see                              | Press                                   |
| ------------------------------------ | --------------------------------------- |
| Not connected                        | **Connect**                             |
| Reconnect required                   | **Reconnect**                           |
| Your username and "GitHub connected" | **Disconnect** to remove the connection |

In the import dialog, a connection GitHub no longer accepts reads "Reconnect GitHub to continue". Press **Reconnect GitHub** there.

## Install the Kosuke App

The Kosuke App is Sensei's GitHub App. Sensei reads and pushes your code through it, so every repository you import needs it installed.

The Repository list shows every repository your GitHub account can reach. Repositories that have the app come first. The rest are greyed out and carry an **Install App** link. A repository your GitHub account can read but not push to is greyed out too, with no link: ask for write access on GitHub to import it.

- To add more repositories to an existing install, press **Configure the Kosuke GitHub App** under the list. GitHub sends you back to the dialog.
- If the repository belongs to a GitHub organization you do not own, an organization owner has to approve the install. GitHub sends them your request, and the dialog reads "Waiting for your org admin". Press **Check again** once they approve. If the dialog asks you to connect instead, press **Connect GitHub** under **Install on GitHub**.
- The owner who approves lands on a page that reads "Kosuke GitHub App installed". They need no Sensei account.
- If a repository is missing from the list, check that your GitHub account can open it on GitHub.

## What importing brings in

- Sensei creates the project and names it after the repository.
- Sensei starts the project's first deploy, as you. Nobody has to press anything.
- Every open pull request on the repository arrives as a chat session. A draft pull request lands in Active, and one ready for review lands in Under Review. These sessions start with no Assignee.
- Pull requests opened on GitHub later arrive as sessions too.
- Its [Merge agent](https://kosuke.ai/docs/set-up/project-settings.md#merge-agent) starts **Off**.
- A repository opens on its [Preview](https://kosuke.ai/docs/set-up/preview-and-publish.md) once its services are set and it has been deployed. Until then it opens on its settings.
- Sensei adds nothing to your repository.

After the import, you stay where you were, such as in Sensei. Until its first deploy succeeds, the sidebar marks the project Setup. In its place it shows a spinner with the deploy's step, such as 2/4, while the deploy runs, a yellow dot when the deploy needs you, and a red dot when it fails. With Sensei, your Sensei Chat gets one line, such as "You imported storefront into Acme. Its first Deploy started." When the deploy waits for a model, the line ends after the first sentence. Anything the deploy needs from you arrives as a Sensei card. To watch the deploy, click the project in the sidebar and open its settings, with the Deploy Chat on the left.

Sessions start only once the first deploy lands. Until then you can file work as Todo tasks. With Sensei, a session you ask it to start before then starts by itself when the deploy lands. See [Sensei](https://kosuke.ai/docs/automate/sensei.md#add-work-and-ship-it).

When the deploy needs secrets only you have, it asks in the Deploy Chat. With Sensei, a card in the project's Deploys thread lets you fill them in and press **Save and continue**. If the first deploy fails, Sensei starts one Recovery Deploy of it. [Deploy your project](https://kosuke.ai/docs/set-up/deploy.md) covers both.

## Whose GitHub account acts

Sensei acts on GitHub as the member who sends the message or presses **Resume** or **Restore**. It uses that member's GitHub Connection when they have one, and the Kosuke App otherwise. The account can change from one turn to the next in the same session.

| Action                                         | With a GitHub Connection                                       | Without one |
| ---------------------------------------------- | -------------------------------------------------------------- | ----------- |
| Commits from your messages or your own commits | Your account is the author. The Kosuke App commits and pushes. | Kosuke App  |
| The pull request the agent opens for you       | Your account                                                   | Kosuke App  |
| Resume                                         | Your account                                                   | Kosuke App  |

Before its first GitHub write in a turn, the agent says in one short line which account the action will come from.

## Next steps

- [Deploy your project](https://kosuke.ai/docs/set-up/deploy.md)
- [Preview and publish](https://kosuke.ai/docs/set-up/preview-and-publish.md)
- [Project settings](https://kosuke.ai/docs/set-up/project-settings.md)
