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? ›

This is all possible thanks to the GitHub Pages feature, which is GitHub's very own free hosting service. Using GitHub Pages, you can create a website by simply publishing static HTML, JavaScript, and CSS files from GitHub's repository.

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? ›

Basic Steps for Hosting Website on GitHub
  1. Step 1: Create a GitHub account.
  2. Step 2: Create a new repository.
  3. Step 3: Create an index. html file and a web. css file.
  4. Step 4: Enable GitHub Pages.
  5. Step 5: Visit your website.
May 16, 2024

Is GitHub Pages completely 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.

Is GitHub self hosted free? ›

GitHub Actions usage is free for standard GitHub-hosted runners in public repositories, and for self-hosted runners. For private repositories, each GitHub account receives a certain amount of free minutes and storage for use with GitHub-hosted runners, depending on the account's plan.

Does it cost money to host on GitHub? ›

GitHub Pages is free of charge for every GitHub user. It is available in public GitHub repositories with a GitHub Free account, plus available in public and private GitHub repositories with a GitHub Pro, GitHub Team or GitHub Enterprise account.

How to host a website for free with a domain name? ›

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.

Does GitHub give free domains? ›

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

How to build a website from scratch on GitHub? ›

Creating your site
  1. On GitHub, navigate to your site's repository.
  2. Decide which publishing source you want to use. ...
  3. Create the entry file for your site. ...
  4. Configure your publishing source. ...
  5. Under your repository name, click Settings. ...
  6. In the "Code and automation" section of the sidebar, click Pages.

Can I earn money from GitHub Pages? ›

Yes. You can ask for donations but extremely few people will. You can provide support for companies that use your software project. The amount of money you will make will depend on how useful and popular your projects are.

Is GitHub free for small business? ›

Why GitHub Pages? Cost-Effective: It's free. You can host your website without any cost, making it an attractive option for students, developers, and small businesses.

Are GitHub Pages good for blogging? ›

You can count on GitHub Pages to reliably host your personal and business sites, and to give you secure access for configuration and content management. 🖱️ You'll also have full control over your blog's look & feel.

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.

Does GitHub have free domains? ›

open-domains / register

Free subdomains for personal sites, open-source projects, and more.

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

Note: To publish a GitHub Pages site privately, your organization must use GitHub Enterprise Cloud. For more information about how you can try GitHub Enterprise Cloud for free, see "Setting up a trial of GitHub Enterprise Cloud."

Is GitHub private free now? ›

GitHub Free for organizations is immediately available and includes private repositories for unlimited users. All organizations previously using Team for Open Source now have GitHub Free. GitHub Free for individual developers now includes unlimited collaborators.

References

Top Articles
Latest Posts
Article information

Author: Kareem Mueller DO

Last Updated:

Views: 6467

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Kareem Mueller DO

Birthday: 1997-01-04

Address: Apt. 156 12935 Runolfsdottir Mission, Greenfort, MN 74384-6749

Phone: +16704982844747

Job: Corporate Administration Planner

Hobby: Mountain biking, Jewelry making, Stone skipping, Lacemaking, Knife making, Scrapbooking, Letterboxing

Introduction: My name is Kareem Mueller DO, I am a vivacious, super, thoughtful, excited, handsome, beautiful, combative person who loves writing and wants to share my knowledge and understanding with you.