Last active
August 29, 2015 14:05
-
-
Save archaeogeek/0c055761343996acd432 to your computer and use it in GitHub Desktop.
Pre-push code for automatically generating GitBook static html, pushing the markdown to a master branch and the generated html to a gh-pages branch on github. Save as a pre-push hook (git 1.8 or above) for the master branch. Set the _book folder and contents to be ignored in the master branch to avoid duplication.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gitbook build /path/to/markdown --output=/path/to/markdown/_book | |
cd /path/to/markdown/_book | |
git init | |
git commit --allow-empty -m 'update book' | |
git checkout -b gh-pages | |
touch .nojekyll | |
git add . | |
git commit -am "update book" | |
git push git@github.com:user/repo gh-pages --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment