> 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/it/configurazione/overleaf-toolkit/git-integration.md).

# integrazione Git

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

{% 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 container git-bridge (solo per utenti Docker-compose)

Per gli utenti che eseguono una configurazione personalizzata `docker-compose.yml`, aggiungi la seguente configurazione del container 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 container `sharelatex`
    volumi:
        - ~/git_bridge_data:/data/git-bridge
    container_name: git-bridge
    expose:
        - "8000"
    ambiente:
        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 container sharelatex

Dovrai anche collegare il `git-bridge` container nel `sharelatex` container e definire le seguenti variabili di 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
    ambiente:
         GIT_BRIDGE_ENABLED: true
         GIT_BRIDGE_HOST: "git-bridge"
         GIT_BRIDGE_PORT: "8000"
<strong>         # Ora usiamo v1; se prima impostavi V1_HISTORY_URL, aggiorna ora
</strong><strong>         V1_HISTORY_URL: "http://sharelatex:3054"
</strong></code></pre>

{% endstep %}

{% step %}

### Autenticazione

Quando si autentica un client git, gli utenti hanno bisogno di un Personal Access Token. Gli utenti possono gestire i Personal Access Token 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 (in generale, i progetti più grandi richiedono più 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 poco spazio su disco, puoi attivare un processo di swap che sposterà su AWS S3 i repository meno utilizzati. Se un repository spostato serve di nuovo, viene riportato sul disco. Le seguenti variabili d'ambiente controllano il processo di swap:

| Nome                                  | Descrizione                                                                                                                                                                                   |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GIT_BRIDGE_SWAPSTORE_TYPE`           | Impostalo su "s3" per attivare il processo di swap.                                                                                                                                           |
| `GIT_BRIDGE_SWAPSTORE_AWS_ACCESS_KEY` | La tua chiave di accesso AWS                                                                                                                                                                  |
| `GIT_BRIDGE_SWAPSTORE_AWS_SECRET`     | Il tuo segreto AWS                                                                                                                                                                            |
| `GIT_BRIDGE_SWAPSTORE_S3_BUCKET_NAME` | Questo bucket conterrà i repository git compressi in ZIP                                                                                                                                      |
| `GIT_BRIDGE_SWAPSTORE_AWS_REGION`     | La regione del bucket                                                                                                                                                                         |
| `GIT_BRIDGE_SWAPJOB_MIN_PROJECTS`     | <p>Numero minimo di progetti da mantenere su disco.<br><br><strong>- Predefinito:</strong> 50</p>                                                                                             |
| `GIT_BRIDGE_SWAPJOB_LOW_GIB`          | <p>Soglia bassa per lo swap. Il processo di swap sposterà i progetti finché l'utilizzo del disco non scenderà al di sotto di questo valore.<br><br><strong>- Predefinito:</strong> 128 GB</p> |
| `GIT_BRIDGE_SWAPJOB_HIGH_GIB`         | <p>Soglia alta per lo swap. Il processo di swap inizierà a spostare i progetti quando l'utilizzo del disco raggiunge questo valore.<br><br><strong>- Predefinito:</strong> 256 GB</p>         |
| `GIT_BRIDGE_SWAPJOB_INTERVAL_MILLIS`  | <p>Intervallo di tempo tra il controllo dell'utilizzo del disco e l'esecuzione del processo 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 dei 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 fare push dei progetti. Nota: gli utenti devono aver effettuato l'accesso per unirsi 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://overleaf-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.
