> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/on-premises/vi/cau-hinh/overleaf-toolkit/dong-bo-hoa-github.md).

# Đồng bộ hóa GitHub

{% hint style="info" %}
Tính năng này được phát triển bởi [ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro), được chỉnh sửa bởi [yu-i-i/overleaf-cep](https://github.com/yu-i-i/overleaf-cep). Nó được giới thiệu từ v6.2.0 trở đi. Nó vẫn đang ở trạng thái beta. Chúng tôi cần phản hồi của bạn nếu bạn gặp bất kỳ vấn đề nào.
{% endhint %}

{% columns %}
{% column %}

<figure><img src="/files/658369be94206562e149701f909b7ccf4d177d8c" alt=""><figcaption></figcaption></figure>

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

{% column %}

<figure><img src="/files/010dd7e3547ec7cb7d70098f29a4072eebd2711b" alt=""><figcaption></figcaption></figure>

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

### Thiết lập đồng bộ hóa GitHub

{% hint style="warning" %}
Bạn cần bật [git-bridge](/on-premises/vi/cau-hinh/overleaf-toolkit/git-integration.md) trước khi sử dụng Đồng bộ hóa GitHub.

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

```dotenv
GIT_BRIDGE_ENABLED=true
```

{% endcode %}
{% endhint %}

Truy cập [cài đặt nhà phát triển](https://github.com/settings/developers) để tạo ứng dụng OAuth GitHub của bạn và sao chép `CLIENT_ID` và `SECRET`.&#x20;

**Lưu ý**: URL callback OAuth của bạn là: `${OVERLEAF_SITE_URL}/user/github-sync/oauth2/callback`.

Sau đó, thêm các cài đặt sau vào các tệp biến môi trường Overleaf của bạn.

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

```dotenv
# dùng để mã hóa token truy cập GitHub của người dùng.
# Cách tạo: `openssl rand -hex 32`
GITHUB_TOKEN_CIPHER_PASSWORD=0123456789ABCDEFG # thay đổi thành của bạn

# Cài đặt đồng bộ hóa GitHub
GITHUB_SYNC_ENABLED=true
GITHUB_SYNC_CLIENT_ID=
GITHUB_SYNC_CLIENT_SECRET=

# OAuth callback là: ${OVERLEAF_SITE_URL}/user/github-sync/oauth2/callback
# (Tùy chọn) GITHUB_SYNC_PROXY_URL=http://10.0.0.1:10808
```

{% endcode %}

{% hint style="warning" %}
Trước khi cấu hình URL callback OAuth GitHub, hãy chắc chắn rằng `OVERLEAF_SITE_URL` được đặt chính xác.
{% endhint %}

Nếu bạn đang ở Trung Quốc đại lục, bạn có thể cần cấu hình proxy để truy cập GitHub. Hãy đặt biến môi trường sau: `GITHUB_SYNC_PROXY_URL=http://10.0.0.1:10808`.

{% hint style="warning" %}
Không sử dụng `127.0.0.1` cho máy chủ proxy. Nếu proxy đang chạy trên máy chủ host, hãy dùng địa chỉ IP LAN của máy chủ (như `192.168.1.xx`) và đảm bảo proxy được cấu hình để chấp nhận kết nối từ các thiết bị trong mạng nội bộ.
{% endhint %}


---

# 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://overleaf-pro.ayaka.space/on-premises/vi/cau-hinh/overleaf-toolkit/dong-bo-hoa-github.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.
