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

# Repositories

> Clone GitHub repositories into every new sandbox, and find where they land.

<Note>
  Repositories need a GitHub connection on your account. If you signed in with Google or an email code, do these steps:

  1. Open [Dashboard > Environment](https://boat.dev/dashboard?tab=environment).
  2. Under GitHub repositories, click **Connect GitHub**.

  This adds GitHub to the account that you already have. You keep the same way to sign in. Nothing else in Boat needs this connection. You can also skip it and use `gh` with your own token inside the sandbox.
</Note>

## Add or remove a repository

Each repository has a base branch and an optional setup script.

* Boat clones the base branch as it is.
* Boat never creates a branch for you, also not for forks.
* A repository stays on the base branch until you, or something inside the sandbox, changes it.

<CodeGroup>
  ```bash CLI theme={null}
  boat env add-repo base octocat/hello-world --branch develop
  boat env rm-repo base octocat/hello-world
  ```

  ```bash curl theme={null}
  repo_id=$(curl -sS "$BOAT_API_BASE/repos?sync=true&q=hello-world" \
    -H "Authorization: Bearer $BOAT_API_KEY" \
    | jq -r '.installations[0].repositories[0].databaseId')

  curl -sS -X POST "$BOAT_API_BASE/repos" \
    -H "Authorization: Bearer $BOAT_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"repositoryId\":\"$repo_id\",\"baseBranch\":\"develop\"}"
  ```

  ```ts TypeScript theme={null}
  const repos = await sandbox.repos({ sync: true, q: "hello-world" });
  const repo = repos.installations.flatMap((i) => i.repositories)[0];

  await sandbox.selectRepo({ repositoryId: repo.databaseId, baseBranch: "develop" });
  ```

  ```python Python theme={null}
  from boat_sdk.models.repo_selection_request import RepoSelectionRequest

  repos = sandbox.repos(sync=True, q="hello-world")
  repo = repos.installations[0].repositories[0]

  sandbox.select_repo(RepoSelectionRequest(repository_id=repo.database_id, base_branch="develop"))
  ```
</CodeGroup>

<Note>
  `selectRepo` and `updateSecrets` change your **default** environment. To edit a named environment, use the calls in [Named environments](/environments/named-environments).
</Note>

## Where repositories land

On the hosted image, the SSH user is `user` and the work directory is `/home/user`. Each folder has the name of the repository, not the `owner/name` pair.

| GitHub repository | Boat path |
| - | - |
| `ariana-dot-dev/ariana-ide-private` | `/home/user/ariana-ide-private` |
| `octocat/hello-world` | `/home/user/hello-world` |

| Number of repositories | Project directory for agent tools |
| - | - |
| One | The repository folder |
| Several | `/home/user` is the parent workspace. Each repository is a folder next to the others. |


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