Estimated reading time: minutes
Set up your Github repo
- Make sure you have Git installed. You can download and install Git for Windows here and Git for Mac here. If you’re on a Mac, chances are you might already have git installed. You can check by opening up a terminal and typing
- Go to Github.com and sign up for an account.
- Click the + button in the upper-right corner and select New repository.
- Name the repository something like mydoctheme.
- Type a description..
- Select the Initialize this repository with a README check box.
- Add a license if desired.
- Leave the other options at the defaults and click Create repository.
- Click the Settings button.
- Go to your repository’s home page, and click the branch drop-down menu.
- Create a new branch called gh-pages.
- Click Settings and change the default branch to gh-pages.
- Go back to your repository’s homepage. With the gh-pages branch selected, copy the https clone url:
- Open a terminal, browse to a convenient location for your project, and type
git clone https://github.com/tomjoht/myreponame.git, replacing the
https://github.com/tomjoht/myreponame.gitwith your repository’s https clone URL that you copied.
- Move the jekyll theme files into this new folder that you just created in the previous step.
- Open the _config.yml file and add the following:
url: tomjoht.github.io baseurl: /myreponame
Change the url to your github account name, and the baseurl to your repo name.
Bundler is a package manager for Ruby that will install all dependencies you might need to build your site locally. I recommend installing Bundler through homebrew. (Sorry, these instructions apply to Mac only.)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
gem install bundler
Add the github pages gem
- In terminal, browse to your Jekyll project directory.
bundle init. This creates a Gemfile and Gemfile.lock in your project.
open gemfile. This opens the gemfile in your default text editor.
Add the following in the gemfile (replacing the existing contents):
source 'https://rubygems.org' gem 'github-pages'
- Add the new jekyll files to git:
git add --all.
- Commit the files:
git commit -m "committing my jekyll theme".
- Push the files up to your github repo:
Github Pages will now automatically build your site. Wait a minute or two, and then visit tomjoht.github.io/yourreponame, replacing this path with your github account and branch.
Customize your URL
You can also customize your Github URL. More instructions on this later….Edit me