> 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/github-pull-request-preview.md).

# GitHub 拉取请求预览

当你向已同步到 GitBook 部分的 GitHub 分支提交拉取请求（PR）时，你可以在合并前预览内容。这使你能够在合并之前检查更改的影响。

你可以使用此功能在合并 PR 之前增加最后一层检查，让你在将更改合并到已同步分支之前，先在非生产环境中查看这些更改。

### 如何访问预览链接

只要你已授予 [GitBook GitHub 应用](https://github.com/apps/gitbook-com) PR 所需的只读权限。

对于使用与 GitBook 部分同步的目标分支创建的每个 PR，你都会看到 PR 上新增一个带有唯一预览 URL 的状态。点击 **详情** 该状态中的链接将带你前往内容的预览 URL。然后你可以在合并 PR 之前确认内容是否符合预期。

{% hint style="info" %}
预览链接仅对拥有 GitBook 帐户的用户可访问。
{% endhint %}

### 安全注意事项

出于安全原因，默认情况下，GitBook 目前不会为从你仓库的 fork 中打开的 PR 生成预览。由于 PR 预览的内容会通过你的自有域名访问，无论是在 `.gitbook.io` 或你的自定义域名下，用户可以在你的公开仓库的 fork 中生成恶意内容，并以你的名义将其提供访问。

我们允许用户通过 Git Sync 设置中的一个选项显式配置此项。

### 常见问题

#### 为什么我在拉取请求中看不到我的 GitBook 文档预览？

常见原因：

* **你的网站尚未发布。** PR 预览 URL 会从你已发布的文档站点提供（在 `.gitbook.io` 或你的自定义域名上）。
* **你的网站受身份验证访问保护。** Git Sync PR 预览不适用于发布在……之后的网站 [经过身份验证的访问](/docs/documentation/zh/fa-bu/site-audience/authenticated-access.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/github-pull-request-preview.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.
