This repository contains a minimal boilerplate for creating a statically hosted GitBook on GitHub Enterprise. To begin using this boilerplate, simply fork this repository.
- Install git. On Windows, ensure that Git Bash is installed, which is normally included with the Windows Git installer. Use Git Bash when running any commands in this README.
- Clone Repository
- Install yarn package manager
- Install gitbook-cli globally
yarn global gitbook-cli
- Install dependencies
yarn install
- gitbook install at the root
- Go to settings. For example, the settings for this repository would be located here:
https://github.ibm.com/nguyenal/gitbook-starter/settings
- Scroll to the GitHub Pages section
- Set Source to master branch / docs folder
This is the primary way to develop documentation with GitBook. The development server will update automatically when changes are made.
$ gitbook serve
The default URL for the development server is:
http://localhost:4000
This is used for generating static HTML/CSS/JS files from markdown notation. We build into the docs folder, because this is where we serve the page from in GHE.
$ gitbook build . docs
After building, we can just commit the entire directory to commit all of our changes, including the statically generated page from the build command.
$ gitbook install (only necessary the first time)
$ gitbook build . docs
$ git add .
$ git commit -m 'my message'
$ git push origin master
If you are receiving the following error:
Error: Error watching file for changes: EPERM
This means gitbook is having trouble updating files. It is possible that your editor has a lock on the directory, so try closing the editor, running gitbook serve
and then loading the editor again.
- Gitbook examples and documentation: https://toolchain.gitbook.com/
- Basic gitbook-cli commands: https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md