ドキュメントには頻繁に更新が加えられ、その都度公開されています。本ページの翻訳はまだ未完成な部分があることをご了承ください。最新の情報については、英語のドキュメンテーションをご参照ください。本ページの翻訳に問題がある場合はこちらまでご連絡ください。

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2021-03-02. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの改善、新機能のためには、最新バージョンのGitHub Enterpriseにアップグレードしてください。 アップグレードに関する支援については、GitHub Enterprise supportに連絡してください。

Jekyll を使用して GitHub Pages サイトを作成する

新規または既存のリポジトリ内に、GitHub Pages Jekyll を使用してサイトを作成できます。

リポジトリの管理者権限があるユーザは、Jekyll を使用して GitHub Pages サイトにコンテンツを作成できます。

GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

ここには以下の内容があります:

必要な環境

Jekyll を使用して GitHub Pages サイトを作成する前に、Jekyll と Git をインストールする必要があります。 詳しい情報については、Jekyll ドキュメンテーションの Installation および「Git のセットアップ」を参照してください。

Jekyll をインストールし動作させるのには Bundler を使うようおすすめします。 Bundler は、Ruby gem の依存関係を管理し、Jekyll ビルドのエラーを減少させ、環境に関係するバグを防止します。 以下はBundlerのインストール手順です。

  1. Rubyをインストールしてください。 詳しい情報については、Rubyのドキュメンテーションの「Rubyのインストール」を参照してください。
  2. Bundlerをインストールしてください。 詳しい情報については「Bundler」を参照してください。

参考: Bundler を使って Jekyll をインストールしようとしている時に Ruby のエラーがある場合、Ruby のインストールをマネージするために、RVM または Homebrew などのパッケージマネージャーが必要になる可能性があります。 詳しい情報については、Jekyllのドキュメンテーションの「トラブルシューティング」を参照してください。

サイト用にリポジトリを作成する

サイトが独立プロジェクトなら、サイトのソースコードを保存するために新しいリポジトリを作成できます。 If your site is associated with an existing project, you can add the source code for your site to a gh-pages branch or a docs folder on the master branch in that project's repository. For example, if you're creating a site to publish documentation for a project that's already on GitHub Enterprise Server, you may want to store the source code for the site in the same repository as the project.

既存のリポジトリにサイトを作成したいのなら、サイトの作成セクションまでスキップしてください。

  1. ページの右上角で ドロップダウンメニューを使い、New repository(新規リポジトリ)を選択してください。
    新しいリポジトリを作成する選択肢を持つドロップダウン
  2. Owner(オーナー)ドロップダウンメニューを使い、リポジトリを所有したいアカウントを選択してください。
    [Owner] ドロップダウンメニュー
  3. リポジトリの名前と、任意で説明を入力してください。 ユーザもしくはOrganizationのサイトを作成しているなら、リポジトリは<user>.github.ioもしくは<organization>.github.ioという名前でなければなりません。 詳しい情報については「GitHub Pagesについて」を参照してください。
    リポジトリ作成フィールド
  4. Choose a repository visibility. 詳細は「リポジトリの可視性について」を参照してください。
    リポジトリの可視性を選択するラジオボタン

サイトを作成する

サイトを作成する前には、GitHub Enterprise Server上にサイトのためのリポジトリを持っていなければなりません。 既存のリポジトリ内にサイトを作成しようとしているのではないなら、「サイトのためのリポジトリの作成」を参照してください。

Warning: If your site administrator has enabled Public Pages, GitHub Pages sites are publicly available on the internet, even if the repository for the site is private or internal. If you have sensitive data in your site's repository, you may want to remove the data before publishing. For more information, see "Configuring GitHub Pages for your enterprise" and "About repository visibility."

  1. ターミナルターミナルGit Bashを開いてください。

  2. リポジトリのローカルコピーがまだない場合、サイトのソースファイルを保存したい場所に移動します。PARENT-FOLDER は、リポジトリを保存したいフォルダの名前に置き換えてください。

    $ cd PARENT-FOLDER
  3. ローカルの Git リポジトリをまだ初期化していない場合は、初期化します。 REPOSITORY-NAME は、リポジトリの名前に置き換えてください。

    $ git init REPOSITORY-NAME
    > Initialized empty Git repository in /Users/octocat/my-site/.git/
    # Creates a new folder on your computer, initialized as a Git repository
  4. ディレクトリをリポジトリに変更します。

    $ cd REPOSITORY-NAME
    # Changes the working directory
  5. If you're creating a project site, decide which publishing source you want to use. If you're creating a user or organization site, you must store your site's source code on the master branch. For more information, see "About GitHub Pages."

  6. サイトの公開ソースにアクセスしてください。 公開元に関する詳しい情報については、「GitHub Pages について」を参照してください。 For example, if you chose to publish your site from the docs folder on the default branch, create and change directories to the docs folder.

    $ mkdir docs
    # Creates a new folder called docs
    $ cd docs

    サイトを gh-pages ブランチから公開する場合には、gh-pages ブランチを作成してチェックアウトします。

    $ git checkout --orphan gh-pages
    # Creates a new branch, with no history or contents, called gh-pages and switches to the gh-pages branch
  7. 新しい Jekyll サイトを作成するには、jekyll new コマンドを使用します。VERSION は、Jekyll の現在の依存関係バージョンに置き換えてください。 詳しい情報については、GitHub Pages サイトで「依存関係のバージョン」を参照してください。

    • Bundler をインストールしている場合、以下のコマンドを入力します。
      $ bundle exec jekyll VERSION new .
      # Creates a Jekyll site in the current directory
    • Bundler をインストールしていない場合、以下のコマンドを入力します。
      $ jekyll VERSION new .
      # Creates a Jekyll site in the current directory
  8. 作成された Gemfile を開き、Gemfile のコメントに従って GitHub Pages を使用します。

    Gemfile の更新手順

  9. gem "github-pages" の行を以下のように更新します。VERSION は、github-pages の現在の依存関係バージョンに置き換えてください。 詳しい情報については、GitHub Pages サイトで「依存関係のバージョン」を参照してください。

    gem "github-pages", "~> VERSION", group: :jekyll_plugins
  10. Gemfile を保存して閉じます。

  11. 必要に応じて、サイトをローカルでテストします。 詳しい情報については、「Jekyll を使用して GitHub Pages サイトをローカルでテストする」を参照してください。

  12. Add your GitHub Enterprise Server repository as a remote, replacing HOSTNAME with your enterprise's hostname, USER with the account that owns the repository, and REPOSITORY with the name of the repository.

    $ git remote add origin https://HOSTNAME/USER/REPOSITORY.git
    
  13. リポジトリを GitHub Enterprise Server にプッシュします。 BRANCH は、作業を行なっているブランチの名前に置き換えてください。

    $ git push -u origin BRANCH
  14. Configure your publishing source. 詳しい情報については「GitHub Pages サイトの公開元を設定する」を参照してください。

  15. GitHub Enterprise Serverで、サイトのリポジトリにアクセスしてください。

  16. リポジトリ名の下で Settings(設定)をクリックしてください。

    リポジトリの設定ボタン

  17. 公開されたサイトを見るには、"GitHub Pages"の下で、サイトのURLをクリックしてください。

    公開されたサイトのURL

    メモ: サイトに対する変更は、その変更をGitHub Enterprise Serverにプッシュしてから公開されるまでに、最大20分かかることがあります。 1時間経っても変更がブラウザーに反映されなければ、「GitHub PagesサイトのJekyllビルドエラーについて」を参照してください。

Note: If your site's source files are located in the default publishing source—master for user and organization sites or gh-pages for project sites—but your site has not published automatically, make sure someone with admin permissions and a verified email address has pushed to the publishing source.

次のステップ

サイトに新しいページを追加したり、投稿したりするには、「Jekyll を使用して GitHub Pages サイトにコンテンツを追加する」を参照してください。

JekyllのテーマをGitHub Pagesサイトに追加して、サイトのルックアンドフィールをカスタマイズできます。詳しい情報については、「Jekyll を使用して GitHub Pages サイトにテーマを追加する」を参照してください。