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

# Repositories

> Check out your code when a Devbox is created, so your agent starts with the repository in place.

A Devbox can check out one or more repositories as it's created, so your agent doesn't clone anything itself. Namespace fetches them through your workspace's GitHub connection, so no token goes into your code, prompts, or spec files. Connect GitHub or Cursor Origin under [Code Providers](https://cloud.namespace.so/workspace/code/providers) first.

## Check out a repository

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox create --name my-devbox --image builtin:default --size m \
  --checkout github.com/your-org/your-repo
```

```typescript TS SDK theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const devbox = await client.devboxes.create({
  name: "my-devbox",
  imageName: "builtin:default",
  size: "m",
  repository: "github.com/your-org/your-repo",
});
```

The repository is cloned with its full history on its default branch, into its own folder in the workspace directory:

| OS | Folder |
| - | - |
| Linux | `/workspaces/your-repo` |
| macOS | `/Users/runner/workspaces/your-repo` |
| Windows | `C:\namespace\workspaces\your-repo` |

## Pick a branch, tag, or commit

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox create --from - <<'EOF'
name: my-devbox
image: builtin:default
size: m
repository:
  url: github.com/your-org/your-repo
  ref: my-branch
EOF
```

```typescript TS SDK theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const devbox = await client.devboxes.create({
  name: "my-devbox",
  imageName: "builtin:default",
  size: "m",
  versionControl: {
    repositories: [
      { repository: "github.com/your-org/your-repo", ref: "my-branch" },
    ],
  },
});
```

A commit SHA checks out that commit with a detached `HEAD`.

## Check out several repositories

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox create --name my-devbox --image builtin:default --size m \
  --checkout github.com/your-org/app \
  --checkout github.com/your-org/shared-lib
```

```typescript TS SDK theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const devbox = await client.devboxes.create({
  name: "my-devbox",
  imageName: "builtin:default",
  size: "m",
  versionControl: {
    repositories: [
      { repository: "github.com/your-org/app" },
      { repository: "github.com/your-org/shared-lib" },
    ],
  },
});
```

## Unpack a snapshot instead of cloning

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox create --from - <<'EOF'
name: my-devbox
image: builtin:default
size: m
repository:
  url: github.com/your-org/your-repo
  checkout_method: git_snapshot_unpack
EOF
```

```typescript TS SDK theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const devbox = await client.devboxes.create({
  name: "my-devbox",
  imageName: "builtin:default",
  size: "m",
  versionControl: {
    repositories: [{
      repository: "github.com/your-org/your-repo",
      checkoutMethod: "git-snapshot-unpack",
    }],
  },
});
```

Namespace prepares a snapshot of the commit and the Devbox unpacks it, instead of fetching the repository's history. The checkout has only that commit and branch.

## Push changes

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox setup-github my-devbox
```

Git in the Devbox fetches through your workspace's GitHub connection. To push as yourself, the command signs `gh` and Git in the Devbox in with your local GitHub CLI's token.

## Workspace default

When you don't pass a repository, a new Devbox checks out your workspace's default repository, if an admin set one. To check out nothing, pass `--no_checkout` in the CLI, or `versionControl: {}` in the TS SDK.

## Related

* [Blueprints](https://namespace.so/docs/devbox/blueprint.md) to check out the same repositories on every new Devbox.
* [`devbox create`](https://namespace.so/docs/reference/devbox-cli/create) and [`devbox setup-github`](https://namespace.so/docs/reference/devbox-cli/setup-github) for every option.


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