Creating your site

  1. Clone the repository that you created before to your local machine.

  2. Change directories to the repository.
    $ cd REPOSITORY-NAME
    # Changes the working directory
    
  3. If you choose to publish your site from the gh-pages branch, create and checkout the gh-pages branch.
    $ git checkout --orphan gh-pages
    # Creates a new branch, with no history or contents, called gh-pages and switches to the gh-pages branch
    
  4. Create a new Jekyll site at ./docs
    jekyll new docs
    
  5. Change into your new directory.
    cd docs
    
  6. Open the Gemfile, then add the following code to the end of the file.
    gem "webrick", "~> 1.7"
    
  7. Install the bundler gems.
    gem install bundler
    
  8. Build the site and make it available on a local server.
    bundle exec jekyll serve
    
  9. Browse to http://localhost:4000

  10. Optionally, make any necessary edits to the _config.yml file.
    title: Quang's Tech Blog
    email: quang.sunlight@gmail.com
    
  11. Add and commit your work.
    git add .
    git commit -m 'Initial GitHub pages site with Jekyll'
    
  12. Push to GitHub.
    git push -u origin gh-pages
    
  13. On GitHub, navigate to your site’s repository.

  14. Under your repository name, click Settings. repo-actions-settings

  15. In the left sidebar, click Pages.
    pages-tab

  16. Under “GitHub Pages”, select gh-pages on Branch drop-down menu. publishing-source-drop-down

  17. Select /docs folder for your publishing source.
    publishing-source-folder-drop-down

  18. Click Save.

  19. To see your published site, under “GitHub Pages”, click your site’s URL. click-pages-url-to-preview

Reference