# GitHub 同步

GitHub 集成目前仅在 [ayaka-notes/overleaf](https://github.com/ayaka-notes/overleaf) 可用。我们非常自豪能为所有人提供此功能，此前该功能仅在 Overleaf SaaS 中可用。

{% hint style="info" %}
此功能由 [ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro)开发，将从 v6.2.0 及更高版本引入。它仍处于测试阶段。如果您遇到任何问题，我们需要您的反馈。
{% endhint %}

{% columns %}
{% column %}

<figure><img src="/files/e85b989b6a70f324fdafc13d71bbaceb31621772" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/995fdcf61888149ab6db800955c9a9fc754a17d7" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/4d91788b4fc018d96935bfe21f68cd1991dbfebc" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ab3b2b2485dc2c4abcabd323c1ae8fad289361da" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### 设置 GitHub 同步

{% hint style="warning" %}
在使用 GitHub 同步之前，您需要先启用 [git-bridge](/on-premises/zh-cn/pei-zhi/overleaf-toolkit/git-integration.md) 。

{% code title="config/overleaf.rc" %}

```dotenv
GIT_BRIDGE_ENABLED=true
```

{% endcode %}
{% endhint %}

访问 [开发者设置](https://github.com/settings/developers) 以创建您的 GitHub OAuth 应用，并复制您的 `CLIENT_ID` 和 `SECRET`.

然后，将以下设置添加到您的 overleaf 环境变量文件中。

{% code title="config/variables.env" overflow="wrap" %}

```dotenv
# 用于加密用户的 GitHub 访问令牌。
CIPHER_PASSWORD=0123456789ABCDEFG # 更改为您自己的

# GitHub 同步设置
GITHUB_SYNC_ENABLED=true
GITHUB_SYNC_CLIENT_ID=
GITHUB_SYNC_CLIENT_SECRET=
GITHUB_SYNC_CALLBACK_URL==http://your.overleaf.com/github-sync/completeRegistration
GITHUB_SYNC_HOST=github-sync
#（可选） GITHUB_SYNC_PROXY_URL=http://10.0.0.1:8888
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://overleaf-pro.ayaka.space/on-premises/zh-cn/pei-zhi/overleaf-toolkit/github-tong-bu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
