Get started with GitHub Pages

GitHub is an open source Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project. In this article, we are going to learn how to get started with GitHub Pages.

GitHub Pages is a static site hosting service designed to host personal, organization, or project pages directly from a GitHub repository. And it does not support server side codes.

GitHub Pages is available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

There are two ways, user or organization site and project site. We get one site per GitHub account and organization, and unlimited project sites.

  1. User or organization site

First create new repository named your-user-name.github.io (ex: if user name is manushakaru repository name looks like manushakaru.github.io )

Clone new repository into your computer

git clone https://github.com/your-user-name/your-user-name.github.io

ex : git clone https://github.com/manushakaru/manushakaru.github.io

Enter the project folder and place your code ( does not support server side codes )

Note that All GitHub Pages sites, including sites that are correctly configured with a custom domain, support HTTPS and HTTPS enforcement. If your site’s HTML still references images, CSS, or JavaScript over HTTP, then your site is serving mixed content and you may have trouble loading assets.

To remove your site’s mixed content, improve your site’s security, and resolve problems related to loading mixed content, edit your site’s HTML files and change http:// to https:// so that all of your assets are served over HTTPS.

Push changes

git add -A

git commit -m ‘initial commit’

git push -u origin master

Your site is published at https://your-user-name.github.io.

Demo site: https://manushakaru.github.io/

2. Project site

Head over to your GitHub repository and navigate to settings.

Scroll down to GitHub Pages section

Select source as master branch for GitHub Pages

Your site is published at https://your-user-name.github.io/repository-name

I hope this article will useful for the beginners of GitHub Pages. Also, follow me at https://medium.com/@manushakarunathilaka.

Leave a comment

Design a site like this with WordPress.com
Get started