> 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/ja/she-ding/overleaf-toolkit/git-integration.md).

# Git 連携

Git 統合は現在、 [ayaka-notes/overleaf](https://github.com/ayaka-notes/overleaf) 現在。

{% hint style="info" %}
この機能は当初、 [ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro).
{% endhint %}

{% stepper %}
{% step %}

### git-bridge を有効にする（Toolkit ユーザーのみ）

Toolkit を使用している場合は、次を有効にしてください。 `git-bridge` 次の内容をあなたの `config/overleaf.rc`:

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

```
GIT_BRIDGE_ENABLED=true
```

{% endcode %}
{% endstep %}

{% step %}

### git-bridge コンテナを追加する（Docker Compose ユーザーのみ）

カスタム `docker-compose.yml`の場合は、compose ファイルに次のコンテナ設定を追加してください：

{% code title="docker-compose.yml（git-bridge サービス）" overflow="wrap" %}

```yaml
git-bridge:
    restart: always
    image: quay.io/sharelatex/git-bridge:4.0.0 # タグは `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/" はバージョン 4.1.6 以前向け
        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 %}

### sharelatex コンテナの設定を更新する

また、次の `git-bridge` コンテナを `sharelatex` コンテナをリンクし、以下の環境変数を定義する必要があります。次に注意してください： `V1_HISTORY_URL`:

<pre class="language-yaml" data-title="docker-compose.yml（sharelatex サービス）"><code class="lang-yaml">sharelatex:
    links:
        - git-bridge
    environment:
         GIT_BRIDGE_ENABLED: true
         GIT_BRIDGE_HOST: "git-bridge"
         GIT_BRIDGE_PORT: "8000"
<strong>         # 現在は v1 を使用しています。以前 V1_HISTORY_URL を設定していた場合は、今すぐ更新してください
</strong><strong>         V1_HISTORY_URL: "http://sharelatex:3054"
</strong></code></pre>

{% endstep %}

{% step %}

### 認証

git クライアントを認証する際、ユーザーには Personal Access Token が必要です。ユーザーはアプリケーション UI から Personal Access Token を管理できます（ドキュメントを参照）。

<figure><img src="/files/4f41d6b85350783a63e90b27c8179d82a3b399dd" alt=""><figcaption><p>Git 統合の Personal Access Token</p></figcaption></figure>
{% endstep %}

{% step %}

### 監視とリソースに関する考慮事項

次を有効にした後は、ホストのリソースを監視することをおすすめします `git-bridge`。負荷の増加は次の要因によって異なります：

* この機能にアクセスするユーザー数
* インスタンスでホストされるプロジェクトの種類（一般に、大きなプロジェクトほどリソースを多く消費します）
  {% endstep %}
  {% endstepper %}

### プロジェクトを S3 にスワップする

Git 統合では、ユーザーがクローンした各プロジェクトについて、完全な git リポジトリがディスク上に保存されます。ディスク容量が限られている場合は、使用頻度の低いリポジトリを AWS S3 に移動するスワップジョブを有効にできます。スワップされたリポジトリが再度必要になった場合は、ディスクに戻されます。スワップジョブは次の環境変数で制御されます：

| 名前                                    | 説明                                                                                                 |
| ------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `GIT_BRIDGE_SWAPSTORE_TYPE`           | スワップジョブを有効にするには、これを「s3」に設定してください。                                                                  |
| `GIT_BRIDGE_SWAPSTORE_AWS_ACCESS_KEY` | AWS アクセスキー                                                                                         |
| `GIT_BRIDGE_SWAPSTORE_AWS_SECRET`     | AWS シークレット                                                                                         |
| `GIT_BRIDGE_SWAPSTORE_S3_BUCKET_NAME` | このバケットには zip 圧縮された git リポジトリが格納されます                                                                |
| `GIT_BRIDGE_SWAPSTORE_AWS_REGION`     | バケットのリージョン                                                                                         |
| `GIT_BRIDGE_SWAPJOB_MIN_PROJECTS`     | <p>ディスク上に少なくとも保持するプロジェクト数。<br><br><strong>- デフォルト：</strong> 50</p>                                 |
| `GIT_BRIDGE_SWAPJOB_LOW_GIB`          | <p>スワップの下限しきい値。ディスク使用量がこの値を下回るまで、スワップジョブはプロジェクトを移動します。<br><br><strong>- デフォルト：</strong> 128 GB</p> |
| `GIT_BRIDGE_SWAPJOB_HIGH_GIB`         | <p>スワップの上限しきい値。ディスク使用量がこの値に達すると、スワップジョブがスワップを開始します。<br><br><strong>- デフォルト：</strong> 256 GB</p>    |
| `GIT_BRIDGE_SWAPJOB_INTERVAL_MILLIS`  | <p>ディスク使用量の確認とスワップジョブの実行の間隔。<br><br><strong>- デフォルト：</strong> 3600000 ms = 1 時間</p>                |

### Q\&A

<details>

<summary>プロジェクトを他の人と共有した場合、Git Bridge の権限モデルはどのように機能しますか？</summary>

読み取り専用アクセスのユーザーはこのプロジェクトをクローンすることしかできません。読み書きアクセスのユーザーはプロジェクトをクローンおよびプッシュできます。注: ユーザーがこのプロジェクトに参加するにはログインしている必要があります。

</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/ja/she-ding/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.
