GitHub

1
Last updated 3 months ago

Keep your content synchronized with a GitHub repository.

GitBook supports a bi-directional GitHub integration: edits on GitBook are pushed to a GitHub repository, and commits pushed to a GitHub repository are imported.

Integration with GitHub is very easy and requires just a few simple steps:

  1. From your space, click on GitHub in the integration listing.

  2. Authorize GitBook to access your GitHub account.

  3. Select the repository that you want to connect.

Once you completed, GitBook will add a web hook to your repository that will allow it to fetch content on every change to the repository. When making changes to GitBook, a new commit will be pushed.

That's it! You can continue editing from GitBook or your GitHub repository.

Setup with an empty repository

When configuring the GitHub integration with an empty repository, GitBook will push an initial commit with the content of your space.

Setup with an existing repository

When configuring the GitHub integration with an existing repository, you'll be prompted to choose which content to use (GitBook or GitHub).

  • When choosing GitHub, it'll replace your space's content with repository's content

  • When choosing GitBook, it'll push your space's content to GitHub

Synchronizing branches

By default, GitBook only imports the master branch. During setup, other branches may be specified. Each new commit to these branches will be imported as a specific GitBook version:

You can use patterns to match branches. For example when entering master docs/*, master as well as all branches starting with docs/ will be imported as versions.