First Example
Create a new Jekyll site at ./myblog.
jekyll new myblogChange into your new directory.
cd myblogBuild the site and make it available on a local server.
bundle exec jekyll serveBrowse 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-FOLDERInitialize a local Git repository, replacing REPOSITORY-NAME with the name of your repository.
$ git init REPOSITORY-NAMEChange directories to the repository.
$ cd REPOSITORY-NAME
# Changes the working directoryTo create a new Jekyll site, use the jekyll new command:
$ jekyll new .
# Creates a Jekyll site in the current directoryOpen 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_pluginsReplace GITHUB-PAGES-VERSION with the latest supported version of the github-pages gem.
You can find this version here: “Dependency versions.”
gem "github-pages", "~> 231", group: :jekyll_pluginsThe 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.gitPush the repository to GitHub, replacing BRANCH with the name of the branch you’re working on.
$ git push -u origin BRANCH