UP

First Example

Create a new Jekyll site at ./myblog.

jekyll new myblog

Change into your new directory.

cd myblog

Build the site and make it available on a local server.

bundle exec jekyll serve

Browse to http://localhost:4000

Creating a GitHub Pages site with Jekyll

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 PARENT-FOLDER

Initialize a local Git repository, replacing REPOSITORY-NAME with the name of your repository.

$ git init REPOSITORY-NAME

Change directories to the repository.

$ cd REPOSITORY-NAME
# Changes the working directory

To create a new Jekyll site, use the jekyll new command:

$ jekyll new .
# Creates a Jekyll site in the current directory

Open the Gemfile that Jekyll created.

Add “#” to the beginning of the line that starts with gem "jekyll" to comment out this line.

Add the github-pages gem by editing the line starting with # gem "github-pages". Change this line to:

gem "github-pages", "~> GITHUB-PAGES-VERSION", group: :jekyll_plugins

Replace GITHUB-PAGES-VERSION with the latest supported version of the github-pages gem. You can find this version here: “Dependency versions.”

gem "github-pages", "~> 214", group: :jekyll_plugins

The correct version Jekyll will be installed as a dependency of the github-pages gem.

Save and close the Gemfile.

From the command line, run bundle update.

Add your GitHub repository as a remote, replacing USER with the account that owns the repository and REPOSITORY with the name of the repository.

$ git remote add origin https://github.com/USER/REPOSITORY.git

Push the repository to GitHub, replacing BRANCH with the name of the branch you’re working on.

$ git push -u origin BRANCH