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.

Settings

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

Source

Under Source select main or master from the dropdown menu and save. GitHub Pages selecting main branch

In a few minutes you will see a URL for your GitHub Pages site for this repository. GitHub Pages url option

Testing

Try accessing the URL in a few minutes to see the index.html page being displayed in the browser.

Note

It may take a few minutes to publish your site on GitHUb Pages from GitHub repository.

Once the site is live you will see your content. You have successfully hosted your repository in GitHub Pages. GitHub Pages test the url

Troubleshooting

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