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

# 仓库

> 了解 GitHub 仓库如何将本地 CLI 命令连接到 Osmosis workspace

workspace repository 是连接到一个 Osmosis platform workspace 的 GitHub 仓库。平台会从 Osmosis workspace template 创建它，或连接已有仓库，然后通过 Git Sync 发现 rollouts 和 configs。

您的本地 workspace directory 是该仓库的 clone。

## CLI Context 的工作方式

当您在 workspace directory 中运行平台命令时，CLI 会：

1. 找到 Git worktree root。
2. 读取 `origin` remote。
3. 将 GitHub 仓库身份规范化为 `owner/repo`。
4. 将该身份发送到平台，让请求限定到匹配的 workspace。

这意味着 `osmosis dataset list`、`osmosis train submit`、`osmosis rollout list` 和 `osmosis model deploy` 等命令都应在已 clone 的 workspace repository 内运行。

```bash theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
git remote get-url origin
osmosis dataset list
```

<Note>
  `origin` remote 必须指向连接到您平台 workspace 的 GitHub 仓库。如果仓库在 GitHub 上被重命名，请先更新本地 remote，再运行 CLI 命令。
</Note>

## 常见要求

| Requirement            | Why it matters                                                                                 |
| ---------------------- | ---------------------------------------------------------------------------------------------- |
| Git worktree           | CLI 使用 Git root 作为 workspace directory。                                                        |
| GitHub `origin` remote | CLI 将 `origin` 映射到平台 workspace。                                                                |
| Platform login         | 平台命令需要 `osmosis auth login` 或 `OSMOSIS_TOKEN`。                                                 |
| Required directories   | `rollouts/`、`configs/training/`、`configs/eval/` 和 `data/` 使目录成为有效 Osmosis workspace directory。 |

如果看起来有问题，运行本地健康检查：

```bash theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
osmosis doctor
```

修复缺失的 scaffold 目录：

```bash theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
osmosis doctor --fix
```

## 仓库所有权

workspace 创建者通常在 onboarding 期间从平台创建仓库。被邀请的成员应 clone 已有 workspace repository，而不是创建单独仓库。

只有 workspace owners 和 admins 可以在平台中管理 GitHub 仓库连接设置。成员如果拥有 GitHub 访问权限，就可以 clone 并使用该仓库。

## 相关命令

```bash theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/cli.json"]}}
osmosis template list
osmosis template apply multiply-local-strands
osmosis rollout init my-rollout
osmosis eval submit configs/eval/my-rollout.toml
osmosis train submit configs/training/my-rollout.toml
```

## 下一步

<CardGroup cols={2}>
  <Card title="Structure & Configuration" icon="folder-tree" href="/zh/cli/workspace/structure-and-config">
    了解仓库布局和配置目录。
  </Card>

  <Card title="Git Sync" icon="code-branch" href="/zh/cli/workspace/git-sync">
    了解 pushes 如何成为平台 rollouts。
  </Card>
</CardGroup>
