让 GitHub 个页面呈现 gh-pages 分支而不是 master 分支上的 Jekyll 内容

Have GitHub Pages render gh-pages branch rather than Jekyll content on master branch

我正在做某事like this here -- https://github.com/cpsievert/knitr-jekyll

但是,GitHub Pages 似乎正在渲染 master 分支而不是 gh-pages 分支。有没有办法确保 GitHub Pages 比 master 更喜欢 gh-pages?

这不是 GitHub 页面呈现错误分支的结果,而是呈现它的 URL 的结果。你的 CSS link 应该是 css/main.css,而不是 /css/main.css.

前导 / 导致浏览器请求 http://cpsievert.github.io/css/main.css 而它应该寻找 http://cpsievert.github.io/knitr-jekyll/css/main.css.

编辑: 无法指定要与 GitHub 页面一起使用的分支。来自 the documentation:

User & Organization Pages live in a special repository dedicated to GitHub Pages files. You will need to name this repository with the account name, e.g. atmos/atmos.github.io.

  • You must use the username.github.io naming scheme.
  • Content from the master branch will be used to build and publish your GitHub Pages site.

Project Pages are similar to User and Organization Pages, with a few slight differences:

  • The gh-pages branch is used to build and publish Project Pages sites.