> 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/getting-started/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/zhan-dian-fang-wen-quan-xian/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/getting-started/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.
