New: AI Insights are here.
See what your users are asking.
Ctrlk
Pricing Log in Sign up
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Git

Connect Git repositories to your space for seamless version control.

Manage the linkage between your GitBook space and external Git repositories, enabling commits, merges, and pull requests directly tied to your documentation.

Pull content into a space from a connected Git repository

post

Triggers an import from the linked Git repository into the space, updating the space's content to match the repository. This is an async operation — it runs in the background after the request returns 204. Use getSpaceGitInfo to check sync status. The space must already have a Git provider configured.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
spaceIdstringRequired

A unique entity identifier

Pattern: ^[a-zA-Z0-9_-]+$
Body
urlstringRequired

URL of the Git repository to import. It can contain basic auth credentials.

refstringRequired

Git ref to import in the format "refs/heads/main"

repoCacheIDstringOptionalDeprecated

Unique identifier to use to cache the Git repository across multiple operations.

repoTreeURLstringOptional

URL to use as a prefix for external file references.

repoCommitURLstringOptional

URL to use as a prefix for the commit URL.

repoProjectDirectorystringOptional

Path to a root directory for the project in the repository.

timestampstring · date-timeOptional

The timestamp of the event that triggered this import. It ensures that Git sync import and export operations are executed in the same order on GitBook and on the remote repository.

forcebooleanOptional
standalonebooleanOptional

If true, the import will generate a revision without updating the space primary content.

Responses
204

Operation to import the repository has been started.

No content

post/spaces/{spaceId}/git/import
204

Operation to import the repository has been started.

No content

Push space content to a connected Git repository

post

Triggers an export of the space's current content to the linked Git repository. This is an async operation — the export runs in the background after the request returns 204. Use getSpaceGitInfo to check the current git sync status. The space must already have a Git provider configured.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
spaceIdstringRequired

A unique entity identifier

Pattern: ^[a-zA-Z0-9_-]+$
Body
urlstringRequired

URL of the Git repository to export to. It can contain basic auth credentials.

refstringRequired

Git ref to push the commit to in the format "refs/heads/main"

commitMessagestringRequired

Message for the commit generated by the export

repoCacheIDstringOptionalDeprecated

Unique identifier to use to cache the Git repository across multiple operations.

repoTreeURLstringOptional

URL to use as a prefix for external file references.

repoCommitURLstringOptional

URL to use as a prefix for the commit URL.

repoProjectDirectorystringOptional

Path to a root directory for the project in the repository.

timestampstring · date-timeOptional

The timestamp of the event that triggered this export. It ensures that Git sync import and export operations are executed in the same order on GitBook and on the remote repository.

forcebooleanOptional
Responses
204

Operation to export the space has been started.

No content

post/spaces/{spaceId}/git/export
204

Operation to export the space has been started.

No content

Get the Git Sync configuration and status for a space

get

Returns metadata about the Git Sync provider connected to the space. Returns 404 if no Git provider is configured. Use this to check sync state before triggering an import or export.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
spaceIdstringRequired

A unique entity identifier

Pattern: ^[a-zA-Z0-9_-]+$
Responses
get/spaces/{spaceId}/git/info

Remove the legacy Git Sync installation from the space to be able to upgrade it to use the new Git integrations

delete
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
spaceIdstringRequired

A unique entity identifier

Pattern: ^[a-zA-Z0-9_-]+$
Responses
204

The legacy Git installation was already removed

No content

delete/spaces/{spaceId}/git/legacy-installation

No content

Last updated

Was this helpful?

AltStyle によって変換されたページ (->オリジナル) /