About Jekyll build errors for GitHub Pages sites
If Jekyll encounters an error building your GitHub Pages site locally or on GitHub Enterprise, you'll receive an error message with more information.
GitHub Pages 可用于具有 GitHub Free 的公共仓库,以及具有 GitHub Pro、GitHub Team、GitHub Enterprise Cloud 和 GitHub Enterprise Server 的公共和私有仓库。
本文内容
About Jekyll build errors
Sometimes, GitHub Pages will not attempt to build your site after you push changes to your site's publishing source.
- You're pushing with a deploy key. If you want to automate pushes to your site's repository, you can set up a machine user instead. For more information, see "Managing deploy keys" in GitHub 开发者文档.
- You're using a CI service that isn't configured to build your publishing source. For example, Travis CI won't build the
gh-pages
branch unless you add the branch to a safelist. For more information, see "Customizing the build" on Travis CI, or your CI service's documentation.
注:对站点的更改在推送到 GitHub Enterprise 后,最长可能需要 20 分钟才会发布。
If Jekyll does attempt to build your site and encounters an error, you will receive a build error message. Jekyll 构建错误消息有两种主要类型。
- A "Page build warning" message means your build completed successfully, but you may need to make changes to prevent future problems.
- A "Page build failed" message means your build failed to complete. If Jekyll is able to detect a reason for the failure, you'll see a descriptive error message.
For more information about troubleshooting build errors, see "Troubleshooting Jekyll build errors for GitHub Pages sites."
查看 Jekyll 构建错误消息
We recommend testing your site locally, which allows you to see build error messages on the command line, and addressing any build failures before pushing changes to GitHub Enterprise. 更多信息请参阅“使用 Jekyll 在本地测试 GitHub Pages 站点”。
When you push changes to your publishing source on GitHub Enterprise, GitHub Pages will attempt to build your site. If the build fails, you'll receive an email at your primary email address. You'll also receive emails for build warnings.
如果在 您的 GitHub Enterprise Server 实例 上启用了出站电子邮件支持,您将只收到电子邮件。 更多信息请联系站点管理员。
You can see build failures (but not build warnings) for your site on GitHub Enterprise in the Settings tab of your site's repository.
You can configure a third-party service, such as Travis CI, to display error messages after each commit.
-
If you haven't already, add a file called Gemfile in the root of your publishing source, with the following content:
source `https://rubygems.org` gem `github-pages`
-
Configure your site's repository for the testing service of your choice. For example, to use Travis CI, add a file named .travis.yml in the root of your publishing source, with the following content:
language: ruby rvm: - 2.3 script: "bundle exec jekyll build"
-
You may need to activate your repository with the third-party testing service. For more information, see your testing service's documentation.