Prerequisites
Before you can use Jekyll to create a site, you must install Jekyll and Git. For more information, see Installation in the Jekyll documentation and "AUTOTITLE."
Creating a repository for your site
Creating your site
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.
shellcd PARENT-FOLDER
If you haven't already, initialize a local Git repository, replacing REPOSITORY-NAME with the name of your repository.
shell$ git init REPOSITORY-NAME > Initialized empty Git repository in /REPOSITORY-NAME/.git/ # Creates a new folder on your computer, initialized as a Git repository
Change directories to the repository.
shell$ cd REPOSITORY-NAME # Changes the working directory
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.
```shell
$ 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.
```shell
$ git checkout --orphan gh-pages
# Creates a new branch, with no history or contents, called gh-pages, and switches to the gh-pages branch
$ git rm -rf .
# Removes the contents from your default branch from the working directory
```
To create a new Jekyll site, use the
jekyll new
command:shell$ jekyll new --skip-bundle . # 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:rubygem "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."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 install
.Open the
.gitignore
file that Jekyll created and ignore the gems lock file by adding this line:shellGemfile.lock
Optionally, make any necessary edits to the
_config.yml
file. This is required for relative paths when the repository is hosted in a subdirectory. For more information, see "AUTOTITLE."yamldomain: my-site.github.io # if you want to force HTTPS, specify the domain without the http at the start, e.g. example.com url: https://my-site.github.io # the base hostname and protocol for your site, e.g. http://example.com baseurl: /REPOSITORY-NAME/ # place folder name if the site is served in a subfolder
Optionally, test your site locally. For more information, see "Testing your site locally with Jekyll."
Add and commit your work.
shellgit add . git commit -m 'Initial GitHub pages site with Jekyll'
Push the repository to , replacing BRANCH with the name of the branch you're working on.
shellgit push -u origin BRANCH
Next steps
To add a new page or post to your site, see "AUTOTITLE."
For more information, see "AUTOTITLE."