> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/wen-dang-ji-dai-ma/git-sync.md).

# GitHub 与 GitLab 同步

<figure><img src="/files/853161f7c0761102c1c12d8d031a99c09c9a4a5d" alt="A GitBook screenshot showing the Git Sync setup"><figcaption><p>为你的 GitBook 文档设置 Git Sync。</p></figcaption></figure>

### 概览

Git Sync 允许技术团队将 GitHub 或 GitLab 仓库与 GitBook 同步，并将 Markdown 文件仓库转换为美观、易用的文档。可直接在 GitBook 强大的编辑器中编辑，同时让内容与 GitHub 或 GitLab 上的代码库保持同步。

Git Sync 是双向的，因此你直接在 GitBook 编辑器中所做的更改会自动同步，GitHub 或 GitLab 上提交的任何更改也同样会同步。这使开发者能够直接从 GitHub 或 GitLab 提交，而技术写作者、教学设计师和产品经理能够直接在 GitBook 中编辑、讨论并反馈更改。

### 设置 Git Sync

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-github">:github:</i></h4></td><td><h4>设置 GitHub Sync</h4></td><td>为 GitBook 设置并授权 GitHub 集成。</td><td><a href="/spaces/seQcoxgdFQZ5VpT0z87G/pages/bbae593a3e2e8d6bc142ba025f3d313ba88e003b">/spaces/seQcoxgdFQZ5VpT0z87G/pages/bbae593a3e2e8d6bc142ba025f3d313ba88e003b</a></td></tr><tr><td><h4><i class="fa-gitlab">:gitlab:</i></h4></td><td><h4>设置 GitLab Sync</h4></td><td>为 GitBook 设置并授权 GitLab 集成。</td><td><a href="/spaces/seQcoxgdFQZ5VpT0z87G/pages/43b32a8f492f683bf35c352f7beb93c38bc089a3">/spaces/seQcoxgdFQZ5VpT0z87G/pages/43b32a8f492f683bf35c352f7beb93c38bc089a3</a></td></tr></tbody></table>

{% hint style="info" %}
Git Sync 支持企业客户的 IP 白名单。如果你的 GitHub、GitLab 或内部网络仅接受来自已批准 IP 的流量，请在启用该集成前将以下 Git Sync 出站 IP 加入白名单：

* `34.136.22.210`
* `34.29.189.57`
* `35.223.181.150`
* `34.72.115.112`
* `136.116.236.109`
  {% endhint %}

{% hint style="info" %}
仅 [管理员和创建者](/docs/documentation/zh/xie-zuo/member-management/roles.md) 可以启用并配置 Git Sync。
{% endhint %}

### 与 AI 代理协作

当你使用 Git Sync 在本地处理文档时，你可以使用 GitBook 的 [skill.md 文件](/docs/documentation/zh/wen-dang-ji-dai-ma/ai-coding-assistants-and-skillmd.md) 为 AI 编程助手提供有关 GitBook 的块、功能和最佳实践的上下文。

前往 [Agent skills](/docs/documentation/zh/wen-dang-ji-dai-ma/ai-coding-assistants-and-skillmd.md) 了解更多。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/wen-dang-ji-dai-ma/git-sync.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
