5

我正在按照本指南开始使用 Jekyll:使用 Jekyll在本地设置您的 GitHub Pages 站点,但我是针对 GitHub Enterprise 执行此操作的。我的仓库位于https://github.company.com/myorg/myrepo,GitHub Pages 来自https://pages.github.company.com/myorg/myrepo(或https://github.company.com/pages/myorg/myrepo)。

教程中的步骤bundle exec jekyll new . --force创建了一个简单的模板站点,我进行了修改_config.yml以包含以下内容:

baseurl: ""
url: "https://pages.github.company.com/myorg/myrepo"
repository: "myorg/myrepo"

但是在我运行之后bundle exec jekyll serve,我看到它会发布到公共 GitHub:

Generating...
   GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
   GitHub Metadata: GET https://api.github.com/repos/myorg/myrepo: 404 - Not Found // See: https://developer.github.com/v3
   GitHub Metadata: GET https://api.github.com/repos/myorg/myrepo/pages: 404 - Not Found // See: https://developer.github.com/v3
   GitHub Metadata: GET https://api.github.com/repos/myorg/myrepo/contributors?per_page=100: 404 - Not Found // See: https://developer.github.com/v3
   GitHub Metadata: GET https://api.github.com/orgs/myorg: 404 - Not Found // See: https://developer.github.com/v3
   GitHub Metadata: GET https://api.github.com/users/myorg/repos?per_page=100&type=public: 404 - Not Found // See: https://developer.github.com/v3
   GitHub Metadata: GET https://api.github.com/repos/myorg/myrepo/releases?per_page=100: 404 - Not Found // See: https://developer.github.com/v3

看着这个:GitHub Pages 上的存储库元数据,我想我可以覆盖一些 GitHub 元数据设置_config.yml以指向 GitHub Enterprise,所以我添加了这个:

github:
  hostname: github.company.com
  pages_hostname: pages.github.company.com
  api_url: https://api.github.company.com
  repository_url: https://github.company.com/myrepo/myorg

但它并没有改变任何东西,它仍然提供给公共 GitHub API。

看着这个:github-metadata,我尝试覆盖 API:

$ PAGES_API_URL="https://api.github.company.com" bundle exec jekyll serve

但它也没有奏效。

该网站实际上是“构建”的,但如果我去那里https://127.0.0.1:4000/的网站标题链接,我会转到http://github.com/pages/myorg/myrepo/. 如何让它真正使用 GitHub Enterprise?

4

2 回答 2

0

在此处添加一个额外的注释。确保在存储库设置的 GitHub Pages 部分中将其标记为已启用。如果您使用的是 Username.github.io 存储库,您将被迫引用主分支。您可以在此处找到更多信息:https ://help.github.com/enterprise/2.9/user/articles/configuring-a-publishing-source-for-github-pages/

于 2017-12-21T21:21:29.667 回答
0

我认为这就是您要查找的内容:https ://help.github.com/enterprise/2.9/user/articles/user-organization-and-project-pages/#project-pages 当然,请确保您的版本GitHub Enterprise 选择正确。

http(s)://[hostname]/pages/<orgname>/<projectname>/,或者http(s)://pages.[hostname]/<orgname>/<projectname>/如果启用了子域。

您可能还需要在存储库设置页面中正确“启用” github 页面:https ://help.github.com/enterprise/2.9/user/articles/configuring-a-publishing-source-for-github-pages/

于 2017-03-26T18:59:15.657 回答