How to create GitHub user site with Jekyll
This is how I created this GitHub user site with Jekyll on macOS.
Prerequisites
-
A GitHub user site
If you don’t have a GitHub user site, please follow Creating a GitHub Pages site to create one
Instructions
Set up environment
-
Install
bundler
andjekyll
without root$ gem install --user-install bundler jekyll
-
Check ruby version
$ ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
-
Add gems path to shell configuration
# If your ruby version is not 2.6.X, # then you need to replace 2.6 with the first two digit of your ruby version $ echo 'export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH"' >> ~/.zshrc
-
Clone
<user>.github.io
repository# Replace <user> with your username $ git clone https://github.com/<user>/<user>.github.io $ cd <user>.github.io
Create the site
-
Create a new Jekyll site
$ jekyll new --skip-bundle .
-
Enable GitHub page in the site
-
open
Gemfile
file -
add
#
to the beginning of the line starts withgem "jekyll"
-
remove
#
from the line starts with# gem "github-pages"
-
install the gem
$ bundle config set --local path 'vendor/bundle' $ bundle install
-
-
Testing the site locally with Jekyll
-
build the site and make it available in local server
$ bundle exec jekyll serve
-
browser to http://localhost:4000
-
Publish the site
-
commit the code to GitHub
$ git add . $ git commit -m 'Initial GitHub pages site with Jekyll' $ git push
Your site should be available at https://<user>.github.io
after a few minutes.