1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/content/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll.md
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

5.6 KiB

title, intro, product, redirect_from, permissions, versions
title intro product redirect_from permissions versions
Creating a GitHub Pages site with Jekyll You can use Jekyll to create a {{ site.data.variables.product.prodname_pages }} site in a new or existing repository. {{ site.data.reusables.gated-features.pages }}
/articles/creating-a-github-pages-site-with-jekyll
People with admin permissions for a repository can create a {{ site.data.variables.product.prodname_pages }} site with Jekyll.
free-pro-team enterprise-server
* *

Prerequisites

Before you can use Jekyll to create a {{ site.data.variables.product.prodname_pages }} site, you must install Jekyll and Git. For more information, see Installation in the Jekyll documentation and "Set up Git."

{{ site.data.reusables.pages.recommend-bundler }}

{{ site.data.reusables.pages.jekyll-install-troubleshooting }}

Creating a repository for your site

{{ site.data.reusables.pages.new-or-existing-repo }}

{{ site.data.reusables.pages.private_pages_are_public_warning }}

{{ site.data.reusables.repositories.create_new }} {{ site.data.reusables.repositories.owner-drop-down }} {{ site.data.reusables.pages.create-repo-name }} {{ site.data.reusables.repositories.choose-repo-visibility }}

Creating your site

{{ site.data.reusables.pages.must-have-repo-first }}

{{ site.data.reusables.command_line.open_the_multi_os_terminal }} 2. If you don't already have a local copy of your repository, navigate to the location where you want to store your site's source files, replacing PARENT-FOLDER with the folder you want to contain the folder for your repository.

$ cd <em>PARENT-FOLDER</em>
  1. If you haven't already, initialize a local Git repository, replacing REPOSITORY-NAME with the name of your repository.
$ git init <em>REPOSITORY-NAME</em>
> Initialized empty Git repository in /Users/octocat/my-site/.git/
# Creates a new folder on your computer, initialized as a Git repository
  1. Change directories to the repository.
$ cd <em>REPOSITORY-NAME</em>
# Changes the working directory

{{ site.data.reusables.pages.decide-publishing-source }} {{ site.data.reusables.pages.navigate-publishing-source }} 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

If you chose to publish your site from the gh-pages branch, create and checkout the gh-pages branch.

$ git checkout --orphan gh-pages
# Creates a new branch, with no history or contents, called gh-pages and switches to the gh-pages branch
  1. To create a new Jekyll site, use the jekyll new command, replacing VERSION with the current dependency version for Jekyll. For more information, see "Dependency versions" on the {{ site.data.variables.product.prodname_pages }} site.
    • If you installed Bundler:
      $ bundle exec jekyll <em>VERSION</em> new .
      # Creates a Jekyll site in the current directory
      
    • If you don't have Bundler installed:
    $ jekyll <em>VERSION</em> new .
    # Creates a Jekyll site in the current directory
    
  2. Open the Gemfile that was created and follow the instructions in the Gemfile's comments to use {{ site.data.variables.product.prodname_pages }}. Instructions for updating Gemfile
  3. Update the gem "github-pages" line so that the line looks like this, replacing VERSION with the current dependency version for github-pages. For more information, see "Dependency versions" on the {{ site.data.variables.product.prodname_pages }} site.
gem "github-pages", "~> <em>VERSION</em>", group: :jekyll_plugins
  1. Save and close the Gemfile.
  2. Optionally, test your site locally. For more information, see "Testing your {{ site.data.variables.product.prodname_pages }} site locally with Jekyll."
  3. Add your {{ site.data.variables.product.product_name }} repository as a remote, replacing {% if currentVersion != "free-pro-team@latest" %}HOSTNAME with your appliance's hostname,{% endif %} USER with the account that owns the repository{% if currentVersion != "free-pro-team@latest" %},{% endif %} and REPOSITORY with the name of the repository.
{% if currentVersion == "free-pro-team@latest" %}
$ git remote add origin https://github.com/<em>USER</em>/<em>REPOSITORY</em>.git
{% else %}
$ git remote add origin https://<em>HOSTNAME</em>/<em>USER</em>/<em>REPOSITORY</em>.git
{% endif %}
  1. Push the repository to {{ site.data.variables.product.product_name }}, replacing BRANCH with the name of the branch you're working on.
$ git push -u origin <em>BRANCH</em>

{{ site.data.reusables.pages.configure-publishing-source }} {{ site.data.reusables.pages.navigate-site-repo }} {{ site.data.reusables.repositories.sidebar-settings }} {{ site.data.reusables.pages.visit-site }}

{{ site.data.reusables.pages.admin-must-push }}

Next steps

To add a new page or post to your site, see "Adding content to your {{ site.data.variables.product.prodname_pages }} site using Jekyll."

{{ site.data.reusables.pages.add-jekyll-theme }} For more information, see "Adding a theme to your {{ site.data.variables.product.prodname_pages }} site using Jekyll."