Skip to content
Automated gitbook publishing from Github to gh-pages
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This module helps publish a Gitbook to gh-pages using the command gitpub

What it does

Once installed, the gitpub command is automatically available. Running the command:

  • Builds the gitbook using gitbook build
  • Checks out to the gh-pages branch
  • Deletes the previous version in gh-pages
  • Extracts the files from the book folder and places them outside
  • Commits the new version to gh-pages


  • Install the package: npm install gitbook-publish@latest
  • Navigate to the branch that contains all the markdown files for your Gitbook
  • Delete the gh-pages branch if it already exists
  • Run command: gitpub

Integration with Travis

An example file for Travis Integration. The USER_NAME, GITHUB_TOKEN and GITHUB_REPO environement variables will need to be set in the Travis environment.

    language: node_js
      - "6"
      - npm install gitbook-cli
      - npm install gitbook-publish@latest
      - gitpub
      - git branch
      - git remote -v
      - git config --global ""
      - git config --global "Akshata"
      - git push --force "https://{USER_NAME}:${GITHUB_TOKEN}${GITHUB_REPO}" gh-pages 

Future Improvements

  • Add flag to push with github username and password
  • Automatically detech if gh-pages exists
  • Inbuilt Travis Integration
You can’t perform that action at this time.