> 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/pt/configuracao/overleaf-toolkit/sincronizacao-com-o-github.md).

# Sincronização com o GitHub

{% hint style="info" %}
Esta funcionalidade foi desenvolvida por [ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro), modificada por [yu-i-i/overleaf-cep](https://github.com/yu-i-i/overleaf-cep). Foi introduzido a partir da v6.2.0 e posteriores. Ainda está em estado beta. Precisamos do seu feedback se tiver algum problema.
{% endhint %}

{% columns %}
{% column %}

<figure><img src="/files/9f2ef7538fcf7167b422ab37a9127a195117a686" alt=""><figcaption></figcaption></figure>

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

{% column %}

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

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

### Configurar a sincronização do GitHub

{% hint style="warning" %}
Tem de ativar [git-bridge](/on-premises/pt/configuracao/overleaf-toolkit/git-integration.md) primeiro antes de usar a sincronização do GitHub.

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

```dotenv
GIT_BRIDGE_ENABLED=true
```

{% endcode %}
{% endhint %}

Visite [definições de programador](https://github.com/settings/developers) para criar a sua aplicação OAuth do GitHub e copiar o seu `CLIENT_ID` e `SEGREDO`.&#x20;

**Notas**: o URL de callback do seu OAuth é: `${OVERLEAF_SITE_URL}/user/github-sync/oauth2/callback`.

Depois, adicione as seguintes definições aos seus ficheiros de variáveis de ambiente do Overleaf.

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

```dotenv
# usado para encriptar o token de acesso do GitHub do utilizador.
# Como gerar: `openssl rand -hex 32`
GITHUB_TOKEN_CIPHER_PASSWORD=0123456789ABCDEFG # alterado para o seu

# Definições de sincronização do GitHub
GITHUB_SYNC_ENABLED=true
GITHUB_SYNC_CLIENT_ID=
GITHUB_SYNC_CLIENT_SECRET=

# o callback OAuth é: ${OVERLEAF_SITE_URL}/user/github-sync/oauth2/callback
# (Opcional) GITHUB_SYNC_PROXY_URL=http://10.0.0.1:10808
```

{% endcode %}

{% hint style="warning" %}
Antes de configurar o URL de callback OAuth do GitHub, certifique-se de que `OVERLEAF_SITE_URL` está definido corretamente.
{% endhint %}

Se estiver localizado na China continental, poderá ter de configurar um proxy para aceder ao GitHub. Defina a seguinte variável de ambiente: `GITHUB_SYNC_PROXY_URL=http://10.0.0.1:10808`.

{% hint style="warning" %}
Não use `127.0.0.1` como host do proxy. Se o proxy estiver a executar-se no servidor anfitrião, use o IP LAN do servidor (como `192.168.1.xx`) endereço e certifique-se de que o proxy está configurado para aceitar ligações de dispositivos na rede local.
{% 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/pt/configuracao/overleaf-toolkit/sincronizacao-com-o-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.
