How to host your web site with 'GitHub Pages'?

19/01/2019 22:59 • ☕️ 1 min read

So, what do you need to do first?

  • Go to your repositories: https://github.com/<your-username>?tab=repositories
  • Choose the repository you want deploy (in my case): aleksandar.ristevski.me
  • Go to Settings tab of the project: Settings Tab
  • In Settings you will find block GitHub Pages there you can choose what branch is the branch you will use to deploy to you hosting site.

    • minimum requirement in order to host is to have index.hml file.
    • when you choose your deployment branch GitHub will give you a link to your hosted project. For example:
      After adding “index.html” file and choosing “master” branch we get message:

      Your site is ready to be published at https://nicewaytodoit.github.io/pgs-test/
  • You can use any branch as deployment branch, but widely addopted way is to use orphan branch called gh-pages

    • How to create gh-pages orphan branch?

      $ git checkout master
      $ git ls-files
      $ git checkout --orphan gh-pages
      $ git rm -rf .
      $ echo "# My orphan ReadMe" > ReadMe.md
      $ git add ReadMe.md
      $ git commit -a -m "Initial commit"
      $ git status
      $ git log --oneline --graph
      $ git checkout master
      $ git log --oneline --graph
      $ git push
  • For additional tutorials and documentation go to: https://pages.github.com/
Published: 19 Jan 2019

Any sufficiently advanced technology is indistinguishable from magic.
Aleksandar Ristevski on Twitter