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:
From your space, click on GitHub in the integration listing.
Authorize GitBook to access your GitHub account.
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.
When configuring the GitHub integration with an empty repository, GitBook will push an initial commit with the content of your space.
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
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 as well as all branches starting with
docs/ will be imported as versions.