> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/on-premises/it/configurazione/overleaf-toolkit/git-integration.md).

# integrazione Git

L'integrazione Git è disponibile solo su [ayaka-notes/overleaf](https://github.com/ayaka-notes/overleaf) attualmente.

{% hint style="info" %}
Questa funzionalità è stata inizialmente sviluppata da [ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro).
{% endhint %}

{% stepper %}
{% step %}

### Abilita il git-bridge (solo per utenti Toolkit)

Se stai usando il Toolkit, abilita il `git-bridge` impostando quanto segue nel tuo `config/overleaf.rc`:

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

```
GIT_BRIDGE_ENABLED=true
```

{% endcode %}
{% endstep %}

{% step %}

### Aggiungi il contenitore git-bridge (solo per utenti Docker Compose)

Per gli utenti che eseguono un `docker-compose.yml`, aggiungi la seguente configurazione del contenitore al tuo file compose:

{% code title="docker-compose.yml (servizio git-bridge)" overflow="wrap" %}

```yaml
git-bridge:
    restart: always
    image: quay.io/sharelatex/git-bridge:4.0.0 # il tag deve corrispondere al tag del contenitore `sharelatex`
    volumes:
        - ~/git_bridge_data:/data/git-bridge
    container_name: git-bridge
    expose:
        - "8000"
    environment:
        GIT_BRIDGE_API_BASE_URL: "http://sharelatex:3000/api/v0/" 
        # "http://sharelatex/api/v0/" per la versione 4.1.6 e precedenti
        GIT_BRIDGE_OAUTH2_SERVER: "http://sharelatex"
        GIT_BRIDGE_POSTBACK_BASE_URL: "http://git-bridge:8000"
        GIT_BRIDGE_ROOT_DIR: "/data/git-bridge"
    user: root
    command: ["/server-pro-start.sh"]
```

{% endcode %}
{% endstep %}

{% step %}

### Aggiorna la configurazione del contenitore sharelatex

Dovrai anche collegare il `git-bridge` contenitore nel `sharelatex` contenitore e definire le seguenti variabili d'ambiente, presta attenzione a `V1_HISTORY_URL`:

<pre class="language-yaml" data-title="docker-compose.yml (servizio sharelatex)"><code class="lang-yaml">sharelatex:
    links:
        - git-bridge
    environment:
         GIT_BRIDGE_ENABLED: true
         GIT_BRIDGE_HOST: "git-bridge"
         GIT_BRIDGE_PORT: "8000"
<strong>         # Ora usiamo v1; se in precedenza impostavi V1_HISTORY_URL, aggiorna ora
</strong><strong>         V1_HISTORY_URL: "http://sharelatex:3054"
</strong></code></pre>

{% endstep %}

{% step %}

### Autenticazione

Per autenticare un client git, gli utenti hanno bisogno di un token di accesso personale. Gli utenti possono gestire i token di accesso personali tramite l'interfaccia dell'applicazione (vedi la documentazione):

<figure><img src="/files/af4aef2192e34c4115ebd92694f731957704cb6e" alt=""><figcaption><p>Token di accesso personale per l'integrazione Git</p></figcaption></figure>
{% endstep %}

{% step %}

### Monitoraggio e considerazioni sulle risorse

Ti consigliamo di monitorare le risorse del tuo host dopo aver abilitato il `git-bridge`. L'aumento del carico dipenderà da:

* il numero di utenti che accedono alla funzionalità
* i tipi di progetti ospitati nella tua istanza (i progetti più grandi sono generalmente più onerosi in termini di risorse)
  {% endstep %}
  {% endstepper %}

### Spostamento dei progetti su S3

L'integrazione Git memorizza su disco un repository git completo per ciascun progetto che viene clonato da un utente. Se hai spazio su disco limitato, puoi attivare un job di swap che sposterà su AWS S3 i repository meno utilizzati. Se un repository spostato serve di nuovo, viene riportato su disco. Le seguenti variabili d'ambiente controllano il job di swap:

| Nome                                  | Descrizione                                                                                                                                                                   |
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GIT_BRIDGE_SWAPSTORE_TYPE`           | Impostalo su "s3" per attivare il job di swap.                                                                                                                                |
| `GIT_BRIDGE_SWAPSTORE_AWS_ACCESS_KEY` | La tua chiave di accesso AWS                                                                                                                                                  |
| `GIT_BRIDGE_SWAPSTORE_AWS_SECRET`     | Il tuo secret AWS                                                                                                                                                             |
| `GIT_BRIDGE_SWAPSTORE_S3_BUCKET_NAME` | Questo bucket conterrà i repository git compressi                                                                                                                             |
| `GIT_BRIDGE_SWAPSTORE_AWS_REGION`     | La regione del bucket                                                                                                                                                         |
| `GIT_BRIDGE_SWAPJOB_MIN_PROJECTS`     | <p>Quanti progetti mantenere su disco, come minimo.<br><br><strong>- Predefinito:</strong> 50</p>                                                                             |
| `GIT_BRIDGE_SWAPJOB_LOW_GIB`          | <p>Soglia bassa per lo swap. Il job di swap sposterà i progetti finché l'uso del disco non scenderà sotto questo valore.<br><br><strong>- Predefinito:</strong> 128 GB</p>    |
| `GIT_BRIDGE_SWAPJOB_HIGH_GIB`         | <p>Soglia alta per lo swap. Il job di swap inizierà a spostare i progetti quando l'uso del disco raggiungerà questo valore.<br><br><strong>- Predefinito:</strong> 256 GB</p> |
| `GIT_BRIDGE_SWAPJOB_INTERVAL_MILLIS`  | <p>L'intervallo di tempo tra il controllo dell'uso del disco e l'esecuzione del job di swap.<br><br><strong>- Predefinito:</strong> 3600000 ms = 1 ora</p>                    |

### Domande e risposte

<details>

<summary>Se condivido il mio progetto con qualcun altro, come funziona il modello di permessi di Git Bridge?</summary>

Gli utenti con accesso in sola lettura possono solo clonare questo progetto; gli utenti con accesso in lettura e scrittura possono clonare e inviare push dei progetti. Nota: gli utenti devono aver effettuato l'accesso per partecipare a questo progetto.

</details>


---

# 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://ayakaleaf-pro.ayaka.space/on-premises/it/configurazione/overleaf-toolkit/git-integration.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.
