> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync.md).

# GitHub と GitLab の同期

GitBook の双方向連携により、GitBook のドキュメントを GitHub または GitLab と同期します

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-9aece8d02ab2c3f0ae5b824fc4cdb37b2100ccbf%2FSite-wide%20Git%20Sync.png?alt=media" alt="A GitBook screenshot showing the Git Sync setup"><figcaption><p>GitBook ドキュメントの Git Sync を設定します。</p></figcaption></figure>

### 概要

Git Sync を使うと、技術チームは GitHub または GitLab のリポジトリを GitBook と同期し、Markdown ファイルのリポジトリを美しく使いやすいドキュメントに変換できます。GitHub または GitLab 上のコードベースと内容を同期したまま、GitBook の強力なエディタで直接編集できます。

Git Sync は双方向で、GitBook のエディタで直接行った変更は自動的に同期され、GitHub または GitLab で行われたコミットも同様に同期されます。これにより、開発者は GitHub または GitLab から直接コミットでき、テクニカルライター、インストラクショナルデザイナー、プロダクトマネージャーは GitBook 上で直接、変更の編集、議論、フィードバックができます。

リポジトリのディレクトリ、コンテンツルート、最初のページ、またはナビゲーションをコードで設定する方法については、 [コンテンツの設定](https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync/content-configuration.md) （ `gitbook-docs.yaml`, `.gitbook.yaml`および `SUMMARY.md`.

### Git Sync を設定する

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-github">:github:</i></h4></td><td><h4>GitHub Sync を設定する</h4></td><td>GitBook 用の GitHub 連携を設定し、承認します。</td><td><a href="https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync/enabling-github-sync.md">GitHub Sync を有効にする</a></td></tr><tr><td><h4><i class="fa-gitlab">:gitlab:</i></h4></td><td><h4>GitLab Sync を設定する</h4></td><td>GitBook 用の GitLab 連携を設定し、承認します。</td><td><a href="https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync/enabling-gitlab-sync.md">GitLab Sync を有効にする</a></td></tr></tbody></table>

{% hint style="info" %}
Git Sync は Enterprise のお客様向けに IP の許可リスト登録をサポートしています。GitHub、GitLab、または社内ネットワークが承認済み IP からのトラフィックのみを受け付ける場合は、連携を有効にする前に、次の送信元 Git Sync IP を許可リストに追加してください:

* `34.136.22.210`
* `34.29.189.57`
* `35.223.181.150`
* `34.72.115.112`
* `136.116.236.109`
  {% endhint %}

{% hint style="info" %}
次のユーザーのみ [管理者と作成者](https://gitbook.com/docs/documentation/ja-gitbook-documentation/collaborate/member-management/roles.md) がGit Syncを有効化して設定できます。
{% endhint %}

### AI エージェントとの連携

Git Syncを使ってドキュメントをローカルで作業する場合は、GitBookの [skill.mdファイル](https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/ai-coding-assistants-and-skillmd.md) を使って、GitBookのブロック、機能、ベストプラクティスに関するコンテキストをAIコーディングアシスタントに提供できます。

詳しくは [Agent skills](https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/ai-coding-assistants-and-skillmd.md) をご覧ください。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
