Thus, I need to build the site myself and let GitHub pages to present my built site.
Note that GitHub pages serving personal users cannot
present the site deployed in
docs dir of
or in root of
gh-pages branch, so I need to put my Jekyll source
development branch, and push the built site to the
branch when I think it is ready to be published.
I have written a script to do it for me:
MESSAGE=$1 echo "Committing..." git commit -m "$MESSAGE" --author "$AUTHOR" echo "Backing up..." mv _site/.git git_backup echo "Building..." jekyll build --quiet echo "Restoring..." mv git_backup/.git _site cd _site echo "Pushing..." git add -- **/* git commit -m "$MESSAGE" --author "$AUTHOR" git push --set-upstream origin master
AUTHOR is your name and email in the format
Before that, I need to initialize the
_site dir as a git repo:
cd site_ git init git remote add origin $REMOTE_URL git add -f -- **/* git commit -m "initial commit" git push -f --set-upstream origin master
REMOTE_URL is the GitHub url of the repo of your site.