How to host your first site for free on GitHub Pages (2024)

Rizèl Scarlett for GitHub

Posted on • Updated on

How to host your first site for free on GitHub Pages (4) How to host your first site for free on GitHub Pages (5) How to host your first site for free on GitHub Pages (6) How to host your first site for free on GitHub Pages (7) How to host your first site for free on GitHub Pages (8)

#github #tutorial #html #beginners

GitHub Pages now uses customizable GitHub Action workflows to build and deploy your code so that developers can control their authoring framework and deployment. GitHub Pages is a powerful option for storing static content for the following reasons:

  • It’s free.
  • It makes collaboration easy. Anyone can open a pull request to update the site.
  • Your repository syncs with any changes you made to your site.
  • While GitHub Pages comes with a default domain name like, https://YOUR_USER_NAME.github.io/ , it supports custom domains.
  • It uses customizable GitHub Action workflows for builds and deployments.

Let’s learn how to host static sites built with HTML on GitHub Pages!

After you create and store HTML in a repository, navigate to the settings tab for that repository.

Click Pages on the left sidebar

Under build and deployment, choose GitHub Actions

This will suggest a few workflows for you based on the code in your repository. You can choose Static HTML.

Clicking configure will lead you to a pre-made workflow. Feel free to review the YAML, tweak it to your preference, and commit the code.

Within a few seconds, your Action will start running. It will generate a URL and deploy your static site to GitHub Pages if successful.

Head over to your URL named yourusername.github.io/your_repo_name to check out your live website!

Gotchas: handling asset paths

When I first published my site on GitHub Pages, I was confused and surprised that I couldn’t see any images or PDFs even though they were present when I locally hosted the site. This happened because GitHub Pages handles paths differently.

For example, if I have PDF living in this relative path: assets/pdfs/menu-food.pdf, then once hosted on GitHub Pages, update the new path to {“REPOSITORY NAME”}/assets/pdfs/menu-food.pdf

Example

Here's an example repository I built using this method

How to host your first site for free on GitHub Pages (16) blackgirlbytes / blackgyalbites

no touch restaurant menu template hosted on GitHub Pages

Template for No-touch Menus and Host Static Pages Built with Any Framework on GitHub Pages

How to host your first site for free on GitHub Pages (17)

Website built with HTML & CSS to display restaurant menus when users scan a QR code.

Powered By GitHub Pages

This is a demonstration to show developers that they can build and host static websites using any framework.See more example frameworks hosted on GitHub Pages:

Live site: https://blackgirlbytes.github.io/blackgyalbites

Design and Development

All designs and elements are open source, available for free for anyone to use.

Owned by Rizel Scarlett (@blackgirlbytes)

Designed by The Holistic Technologist

Illustrations by Cuoc Doi Prints

Feel free to fork, copy, tweak, and use for any purpose. This project is completely open source, and under MIT license.

Menu Design Template: Canva

Download Assets & Design Elements: Google Drive

How to host your first site for free on GitHub Pages (18)




Learn more


Watch this awesome YouTube short by Kedasha demonstrating how to use a customized workflow to deploy a static site generator to GitHub Pages!

I'd love your thoughts on the new customized workflows to deploy to GitHub Pages. Comment below! For more content like this, follow GitHub and me on DEV!

Top comments (3)

Subscribe

irishgeoff9

irishgeoff9

ceo of fabform.io

  • Email

    irishgeoff9@gmail.com

  • Location

    New York

  • Joined

Sep 24 '22

  • Copy link

If you wish to add a contact form to your static website on github pages. This is a handy tutorial.

create a static website with contact form on github pages

Vincent A. Cicirello

Vincent A. Cicirello

Researcher and educator in A.I., algorithms, evolutionary computation, machine learning, and swarm intelligence

  • Location

    NJ

  • Education

    Ph.D. in Robotics, Carnegie Mellon University

  • Work

    Professor of Computer Science at Stockton University

  • Joined

Aug 12 '22

  • Copy link

If I'm currently using what appears to now be called the "classic" which deploys from a branch, what is the advantage to switching a non-jekyll site to the new GitHub Actions? What kind of customizations does the new way support?

Deotyma

Deotyma

Hello I'm a javascript developer and I continue my formation in Java and Python

  • Location

    Paris

  • Education

    Simplon and Société Générale

  • Work

    I'm a volunteer in AideUkraine.fr

  • Joined

Dec 12 '22

  • Copy link

Thanks

For further actions, you may consider blocking this person and/or reporting abuse

How to host your first site for free on GitHub Pages (2024)

FAQs

Can I host my website on GitHub for free? ›

GitHub Pages is GitHub's answer to project pages, and it allows you to serve any static website straight from your repository. Since GitHub pages support custom domains, you can host a static website on GitHub pages free of charge, with deploys straight from Git.

What is the limit of GitHub Pages free hosting? ›

Usage limits

Published GitHub Pages sites may be no larger than 1 GB. GitHub Pages deployments will timeout if they take longer than 10 minutes. GitHub Pages sites have a soft bandwidth limit of 100 GB per month.

How to effortlessly create a website for free with GitHub Pages? ›

How to Host a Website Using GitHub Pages
  1. Create a GitHub Repository. Login to your GitHub account and create a new public repository named <username>. ...
  2. Clone the Repository on Your Local Machine. ...
  3. Create an Index. ...
  4. Push the Local Changes to the Remote Host. ...
  5. Open a Browser and View Your Website.

Is GitHub Pages good for hosting a website? ›

It depends on the specific requirements of your website. GitHub Pages is a great option for hosting static websites, such as a personal blog or portfolio. It is also a good choice if you are already using GitHub to manage your code and want to keep everything in one place.

Is it possible to host a website for free? ›

Can I host a website for free? Yes, platforms such as Wix, Weebly, AwardSpace, and InfinityFree provide options to host websites for free. Each comes with different levels of storage, bandwidth, and server access. WordPress.com also offers a basic free hosting plan suitable for personal blogs and small websites.

Is GitHub Pages still free? ›

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

How much does it cost to host a website on GitHub? ›

Is GitHub hosting free, or are there any costs involved? GitHub offers free hosting for static websites through GitHub Pages. However, if you require custom domain support or need to host private repositories, there may be additional costs associated with those features.

What is the difference between Netlify and GitHub Pages? ›

Netfily can bind multiple domain names, while GitHub Pages can only bind one domain name. With Netfily, the original repository can be private, while GitHub Pages free tier requires the original repository to be public.

How much can you store on GitHub for free? ›

GitHub Team provides 2 GB of free storage. For any storage you use over that amount, GitHub will charge $0.008 USD per GB per day, or approximately $0.25 USD per GB for a 31-day month.

Does GitHub give free domains? ›

As a part of GitHub Student Developer Pack, NameCheap provides a free domain for 1 year.

Is custom domain free GitHub Pages? ›

GitHub Pages is a free hosting service provided by GitHub that allows you to publish static websites directly from your GitHub repositories. By default, GitHub Pages provides a domain in the format – username.github.io/repository , but you can also use a custom domain for your website.

Can a GitHub Pages site be private? ›

With access control for GitHub Pages, you can restrict access to your project site by publishing the site privately. A privately published site can only be accessed by people with read access to the repository the site is published from.

Is GitHub Pages good for portfolio websites? ›

GitHub Pages is a static site hosting service that allows you to host your website directly from your GitHub repository. It is a great way to host your personal, organization, or project pages directly from a GitHub repository.

Is GitHub better than WordPress? ›

You can even use GitHub Pages to host a static version of a WordPress website. However, if you're looking to build a more complex and/or dynamic site, you're probably better off with WordPress. But if you need a free site and don't mind coding a bit, the performance you get out of GitHub Pages may be worth it to you.

Can GitHub Pages host a dynamic website? ›

GitHub supports hosting a static website but if you have a dynamic website, you can choose another service that can provide you with better functionalities and support.

Can GitHub be used for free? ›

GitHub offers free and paid plans for storing and collaborating on code. Some plans are available only to personal accounts, while other plans are available only to organization and enterprise accounts. For more information about accounts, see "Types of GitHub accounts."

Can I use GitHub free for my company? ›

All organizations can own an unlimited number of public and private repositories. You can use organizations for free, with GitHub Free, which includes limited features on private repositories.

Can I host my website on GitHub as a private repository? ›

With access control for GitHub Pages, you can restrict access to your project site by publishing the site privately. A privately published site can only be accessed by people with read access to the repository the site is published from.

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Msgr. Refugio Daniel

Last Updated:

Views: 5627

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.