GitHub Pages

GitHub Pages is a static site hosting service designed to host your personal, organization, or project pages directly from a GitHub repository.

In the previous course you used the GitHub Pages by creating a repository with username.github.io where username is your GitHub.com username. This is one way of automatically setting up GitHub Pages site, although this is limited to only one repository as you can only create a single repository with that name.

We will look into how we can setup any repository to be hosted on GitHub pages as a static site.

Once we have created our public repository, we can go into the settings of the repository. GitHub Pages Settings

Select Pages from the left side menu. GitHub Pages page options tab

Select main from the dropdown menu and save. GitHub Pages selecting main branch

You will see a URL for your GitHub Pages site for this repository. GitHub Pages url option

Try accessing the URL in a few minutes to see the index.html page being displayed in the browser. This may take a few minutes to make your site available live, GitHub Pages test the url

You have successfully hosted your repository in GitHub Pages. If this is not working please note the following troubleshooting steps:

  • Check that the file name is index.html all lowercase
  • Check that your index.html file has some content