サイト用にリポジトリを作成する
サイトが独立プロジェクトなら、サイトのソースコードを保存するために新しいリポジトリを作成できます。 If your site is associated with an existing project, you can add the source code to that project's repository, in a /docs
folder on the default branch or on a different branch. For example, if you're creating a site to publish documentation for a project that's already on GitHub, you may want to store the source code for the site in the same repository as the project.
既存のリポジトリにサイトを作成したいのなら、サイトの作成セクションまでスキップしてください。
Warning: GitHub Pages sites are publicly available on the internet, even if the repository for the site is private or internal. サイトのリポジトリにセンシティブなデータがあるなら、公開前にそれを取り除くのが良いでしょう。 For more information, see "About repository visibility."
- ページの右上角で ドロップダウンメニューを使い、New repository(新規リポジトリ)を選択してください。
- Owner(オーナー)ドロップダウンメニューを使い、リポジトリを所有したいアカウントを選択してください。
- リポジトリの名前と、任意で説明を入力してください。 ユーザもしくはOrganizationのサイトを作成しているなら、リポジトリは
<user>.github.io
もしくは<organization>.github.io
という名前でなければなりません。 詳しい情報については「GitHub Pagesについて」を参照してください。 - Choose a repository visibility. 詳細は「リポジトリの可視性について」を参照してください。
- [Initialize this repository with a README] を選択します。
- Click Create repository.
サイトを作成する
サイトを作成する前には、GitHub上にサイトのためのリポジトリを持っていなければなりません。 既存のリポジトリ内にサイトを作成しようとしているのではないなら、「サイトのためのリポジトリの作成」を参照してください。
-
GitHubで、サイトのリポジトリにアクセスしてください。
-
Decide which publishing source you want to use. For more information, see "About GitHub Pages."
-
選択した公開元が既に存在する場合、公開元に移動します。 選択した公開元がまだ存在しない場合は、公開元を作成します。
-
公開元のルートに、サイトのメインページに表示したいコンテンツを含んだ、
index.md
という名前の新しいファイルを作成します。 -
Configure your publishing source. 詳しい情報については「GitHub Pages サイトの公開元を設定する」を参照してください。
-
リポジトリ名の下で Settings(設定)をクリックしてください。
-
公開されたサイトを見るには、"GitHub Pages"の下で、サイトのURLをクリックしてください。
メモ: サイトに対する変更は、その変更をGitHubにプッシュしてから公開されるまでに、最大20分かかることがあります。 1時間経っても変更がブラウザーに反映されなければ、「GitHub PagesサイトのJekyllビルドエラーについて」を参照してください。
Note: If your site has not published automatically, make sure someone with admin permissions and a verified email address has pushed to the publishing source.
次のステップ
新しいファイルを追加で作成することにより、ページを追加できます。 各ファイルは、公開元と同じディレクトリ構造で、サイト上に表示されます。 For example, if the publishing source for your project site is the gh-pages
branch, and you create a new file called /about/contact-us.md
on the gh-pages
branch, the file will be available at https://<user>.github.io/<repository>/about/contact-us.md
で表示されます。
また、サイトの見た目をカスタマイズするため、テーマを追加できます。 For more information, see "Adding a theme to your GitHub Pages site with the theme chooser."
サイトを更にカスタマイズするには、Jekyll を使用できます。Jekyll は、GitHub Pages に組み込まれている静的サイトジェネレータです。 詳しい情報については、「GitHub Pages と Jekyll」を参照してください。