According GitHub's Help on User, Organization, and Project Pages, there are few important differences on how those kind of pages are served over HTTP(S).
- User and Organization Pages will be published with content of the master-Branch, while the repository must match the schema <username>.github.io.
- Project Pages are published with content of the gh-pages-Branch of a certain project repository.
This short guide will show you how to automate publishing for User and Organization Pages with Travis-CI and Jekyll. The topic has been discussed on stackoverflow many times. This is kind of a best-of using an HTTPS API Token (via environment variable) and keeping the history of the published master-branch.
It's only five steps
- Create a repository <username>.github.io with an empty commit on master.
- Create a jekyll-Branch based on the master-Branch and put your Jekyll-site into it.
- Connect Travis-CI with GitHub and create an access token to allow
git pushfor the build job.
- Go to the Travis-CI Dashboard, activate the build job for your repository and add an Environment Variable with the name
GITHUB_ACCESS_TOKENand the newly generated token.
- Last but not least, add the
.travis.ymlfile below to your
jekyllbranch, adjust it, commit and push.
Ensure to redirect any output of
git push to
/dev/null! Otherwise it will leak your access token!