Alaa Ali
Alaa Ali

Reputation: 926

Jekyll with GitHub Enterprise

I'm following this guide to get me started with Jekyll: Setting up your GitHub Pages site locally with Jekyll, but I'm doing this against GitHub Enterprise. My repo is at https://github.company.com/myorg/myrepo, and GitHub Pages are served from https://pages.github.company.com/myorg/myrepo (or https://github.company.com/pages/myorg/myrepo).

The step bundle exec jekyll new . --force in the tutorial created a simple template site, and I modified _config.yml to include this:

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

But after I ran bundle exec jekyll serve, I see it going out to public 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

Looking at this: Repository metadata on GitHub Pages, I figured I could override some GitHub metadata settings in _config.yml to point to GitHub Enterprise, so I added this:

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

But it doesn't change anything, it still goes out to public GitHub API.

Looking at this: github-metadata, I tried overriding the API:

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

But it didn't work either.

The site does actually 'build', but if I go to https://127.0.0.1:4000/ the site title link in there takes me to http://github.com/pages/myorg/myrepo/. How do I get it to actually use GitHub Enterprise?

Upvotes: 5

Views: 880

Answers (2)

CameronK
CameronK

Reputation: 3

One additional note to add here. Make sure that in the GitHub Pages section of your repository settings is marked as enabled. If you are using your Username.github.io repo, you will be forced to reference the main branch. You can find more info here: https://help.github.com/enterprise/2.9/user/articles/configuring-a-publishing-source-for-github-pages/

Upvotes: 0

yegeniy
yegeniy

Reputation: 1292

I think this is what you are looking for: https://help.github.com/enterprise/2.9/user/articles/user-organization-and-project-pages/#project-pages Of course, make sure your version of GitHub Enterprise is correctly chosen.

http(s)://[hostname]/pages/<orgname>/<projectname>/, or http(s)://pages.[hostname]/<orgname>/<projectname>/ if subdomains are enabled.

You may also need to "enable" the github pages properly in your repositories settings page: https://help.github.com/enterprise/2.9/user/articles/configuring-a-publishing-source-for-github-pages/

Upvotes: 0

Related Questions