This site uses third-party cookies, learn more or accept

Host a free static site with GitHub Pages

Create and launch a free static site with GitHub Pages
Written by Maxwell Pelic,

Did you know you can host a free static site with Github pages? It’s completely free, the only catch is you have to have your repo public on GitHub. But that shouldn’t be a problem since your site is static and all the files should be accessible anyway.

Here’s how you can host your site:

Upload your files and make your site live

Create an account

If you haven’t already, create a Github account. You can create an account at github.com/join. Enter your details and click the “Create an account” button.

Make a new Repo

Create a new repository by clicking the “New” button on your list of repositories. Upload your files to the repository by clicking the “Upload files” button, or clone your repo if you have an application like Sourcetree downloaded.

Enable GitHub Pages

Once you uploaded your files, click on the settings tab and scroll down to the GitHub Pages section. Select “master branch” as the source.

At this point, your site is live! You can view your site at the link listed (your-username.github.io/repository-name). It might take a minute for your site to be live.

Add a custom domain

This step is optional, but you can add a custom domain to your site. The first step is purchasing your domain, but you can get them pretty cheap from sites like NameCheap or Google Domains.

Once you create your domain, enter it on the settings page of your GitHub Repository in the custom domain field.

Point your domain to the GitHub Pages server

In addition to entering your domain, you’ll need to point it to the GitHub Pages server.

In your domain settings, set up A records in your DNS settings that point to these IP addresses:


185.199.108.153

185.199.109.153

185.199.110.153

185.199.111.153

Note: it might take a few minutes to update your DNS records.

Once your DNS record is updated, you should be able to see your site by visiting your custom domain

Use Cloudflare for a custom SSL Certificate

With modern web browsers, it’s a good idea to have an SSL Certificate installed for your domain. You can get a free certificate by setting up a Cloudflare account.

After you set up a Cloudflare account, add your custom domain to your account. You’ll have to point your domain to the Cloudflare nameservers, but it should copy your DNS settings from your current nameservers. If it doesn’t, you can just create the same records mentioned before.

That’s the basics of setting up a free GitHub Pages account. You can view more information about GitHub Pages here

Previous Article: Free Resources for Web Devs

Next Article: Pros and Cons of website builders