---
title: 同步多个 GitHub 文件夹
slug: docs/cn/dqFj-github
createdAt: 2024-05-31T09:33:54.800Z
---

如果您的仓库中有多个用于文档的文件夹，现在您可以将它们全部与 Archbee 同步。

:::hint{type="warning"}
关于如何集成 Archbee 和 GitHub 的提醒：
:::

如果您需要回忆如何[集成两者](https://docs.archbee.com/github#jJpEV)，这里有一份完整指南。

到目前为止，您只能在`.archbee.yaml`文件中使用单个文件夹以及单个文档项目。现在，您可以使用多个文件夹来实现。

如果 Archbee 在仓库根目录或任何其他文件夹中找到`.archbee.yaml`文件，我们就会使用它来组织内容。这个文件在所有存储文档的文件夹中都是相同的。

以下是如何设置和配置您的 Git 仓库的示例，使 Archbee 能够获取其中的内容并在我们的软件中整齐配置 > [Archbee git 仓库](https://github.com/dragosbulugean/slate)


## 设置仓库

请参考上述 Archbee 仓库。

如果系统在仓库根目录找到`.archbee.yaml`文件，如[此示例](https://github.com/dragosbulugean/slate/blob/master/.archbee.yaml)，我们就会用它来组织内容。如果没有，我们将设置一些默认值。

### 为多个文件夹创建 .yaml 文件

创建一个`.archbee.yaml`文件，使用以下变量结构。

:::hint{type="info"}
您必须将文件放在仓库的根文件夹中。确保文件保留在该位置，因为它是所有其他文件夹的默认路径。
:::

- `root: ./docs` 属性定义了包含文档的目录位置（可替换为`docsPath: ./docs`）
- `结构：`
  - `摘要: summary.md` 在 Archbee 左侧导航栏中重建文档树。如果没有该文件，我们会将文件夹视为类别并模拟文件结构。
  - `资产：资产` 资源文件夹相对于 docsPath。Archbee 将上传该文件夹中的所有文件。
- \# 这将包含仓库中的所有代码文件
- `shadowDocs` 定义要作为 Shadow Docs 包含的代码文件/文件夹
- `发布空间` 布尔值，设置`真` 以在每次提交后将空间发布到生产门户

![](https://api.archbee.com/api/optimize/bNBm7nPJgXjbjLyfbHNh2/ARwFXBxpMGGn8Y8Ce1OhI_git-sync-light.png)

下面是一个带有`archbee.yaml`配置文件的示例，其中包&#x542B;***默认***&#x8DEF;径（文件夹）。

:::CodeblockTabs
.archbee.yaml

```yaml
root: ./docs
structure:
  summary: summary.md
  assets: assets
publishSpace: true
headerIncludes:  |
  <script>
  document.getElementById("demo").innerHTML = "Hello JavaScript!";
  </script> 
```
:::

以下是带有`archbee.yaml` 配置文件，包&#x542B;***子路径***&#x7684;示例：

```javascript
root: folderx
structure:
  summary: summary.md
  assets: assets
publishSpace: true
headerIncludes:  |
  <script>
  document.getElementById("demo").innerHTML = "Hello JavaScript!";
  </script> 
```

完成后，请返回 Archbee 并检查是否能够在下拉菜单中选择多个文件夹：

![](https://api.archbee.com/api/optimize/bNBm7nPJgXjbjLyfbHNh2/KLw-OyxXwYqareQUJNNUC_git-select-light.png "选择 GitHub repo")

我们还建议您创建一个 `summary.md` 文件。该文件会在 Archbee 左侧导航面板中重建文档树，并有助于您更好地组织内容。

请参阅下面的一个 `summary.md` 文件示例：

:::CodeblockTabs
summary.md

```markdown
- [Introduction](1.md)

## Table of contents

- [Init](init.md)
- [Configure App](config.md)
- [Config Database](config-database.md)
- [Config Redis](config-redis.md)
- [Config Elastic Search](config-es.md)
- [Swagger](swagger-v2.json)

```
:::

## 在 Archbee 中同步

当您创建一个新空间并选择您的 repo 时，更改会自动在 Archbee 中同步。

如果未能自动同步，您可以通过导航到 **空间设置** > **GitHub 集成&#x20;**> 点击 **与仓库同步** 按钮来强制同步。

![](https://api.archbee.com/api/optimize/bNBm7nPJgXjbjLyfbHNh2/0yk-oP4X5jVKXKxVdWJlZ_settings-light.png "与 repo 同步")

