Deploy Static HTML to GitHub Pages

Ann Jul 09, 2026

Deploying a static HTML website to GitHub Pages is an efficient and cost-effective way to host your website. GitHub Pages provides a simple and fast way to publish your personal website, project documentation, or even a blog. Here's a comprehensive guide on how to achieve this.

GitHub - peaceiris/actions-gh-pages: GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.
GitHub - peaceiris/actions-gh-pages: GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.

Before we dive into the process, ensure you have a basic understanding of Git and GitHub. If you're new to these tools, consider exploring their documentation first. Now, let's get started with deploying your static HTML website to GitHub Pages.

Static web pages are pre-built and remain
Static web pages are pre-built and remain

Preparing Your HTML Files

First, ensure your HTML files are ready for deployment. If you're using a framework like Jekyll or Hugo, you might need to build your site first. For simple HTML sites, you're good to go.

Deploying React Apps: A Guide to Using GitHub Pages
Deploying React Apps: A Guide to Using GitHub Pages

Organize your files in the root directory of your project. If you're using a CSS framework like Bootstrap, ensure all the necessary files are included. The same goes for any JavaScript libraries you might be using.

Setting Up Your GitHub Repository

Getting to Know GitHub Pages: Static Project Pages, Fast | Envato Tuts+
Getting to Know GitHub Pages: Static Project Pages, Fast | Envato Tuts+

Create a new repository on GitHub. This will serve as the remote repository for your website. Name it in the format yourusername.github.io, where yourusername is your GitHub username. This is a requirement for GitHub Pages to recognize the repository as a user or project page.

Once the repository is created, clone it to your local machine. This will allow you to push your HTML files to the remote repository.

Pushing Your HTML Files to GitHub

Follow the Steps Outlined in This Guide to Set Up Your GitHub Repository As Web Page,
Follow the Steps Outlined in This Guide to Set Up Your GitHub Repository As Web Page,

Navigate to the cloned repository on your local machine. Here, you'll see a README.md file and possibly other files GitHub created for you. Delete these files as they are not necessary for your static HTML site.

Now, copy your HTML files into this directory. You can do this manually or use the command line with the cp command. Once your files are in the directory, you can commit and push them to the remote repository.

Configuring GitHub Pages

GitHub vs. Netlify
GitHub vs. Netlify

Now that your HTML files are in the GitHub repository, it's time to configure GitHub Pages to serve them as a website.

In your repository, create a new file named CNAME (without any file extension). This file is used to map a custom domain to your GitHub Pages site, but it's also required for GitHub Pages to recognize your repository as a website. You can leave this file empty.

How To Deploy a React App on GitHub Pages (Two Different Ways)
How To Deploy a React App on GitHub Pages (Two Different Ways)
a screen shot of a web page with the words'html input types '
a screen shot of a web page with the words'html input types '
Static Site Generator vs. CMS: Which is Right for You?
Static Site Generator vs. CMS: Which is Right for You?
HTML Document Structure
HTML Document Structure
HTML Cheat Sheet 📄✨ Quick Guide for Beginners
HTML Cheat Sheet 📄✨ Quick Guide for Beginners
HTML uses tags to control the structure of a web page
HTML uses tags to control the structure of a web page
two screens showing different types of web pages
two screens showing different types of web pages
Git vs GitHub Explained (Day 24 Git Guide)
Git vs GitHub Explained (Day 24 Git Guide)
How To Build A Tribute Page (freeCodeCamp Challenge)
How To Build A Tribute Page (freeCodeCamp Challenge)
an image of a web page with the text'html inputt types '
an image of a web page with the text'html inputt types '
a red and black text description for a web page with an arrow pointing to it
a red and black text description for a web page with an arrow pointing to it
Push Your Local Project to GitHub: Git Setup Guide for Beginners
Push Your Local Project to GitHub: Git Setup Guide for Beginners
Managing Static Files in Django Development
Managing Static Files in Django Development
the different types of html tags are shown in this screenshote screen graber
the different types of html tags are shown in this screenshote screen graber
HTML + CSS Cheat Sheet (One Page) 💻
HTML + CSS Cheat Sheet (One Page) 💻
an image of a web page with different colors and font on the bottom, including two separate
an image of a web page with different colors and font on the bottom, including two separate
✨ Create an Animated Button in HTML & CSS! 🚀 #Coding #CSSAnimation #Shorts
✨ Create an Animated Button in HTML & CSS! 🚀 #Coding #CSSAnimation #Shorts
How To Create Overlaping Elements In HTML & CSS
How To Create Overlaping Elements In HTML & CSS
an image of the back side of a computer screen with text that reads, add css to html
an image of the back side of a computer screen with text that reads, add css to html
login form html css
login form html css

Setting the GitHub Pages Source

Go to the Settings tab of your repository. Scroll down to the "GitHub Pages" section. Here, you'll see a dropdown menu labeled "Source". Select the main branch (or whatever branch you pushed your HTML files to).

Click "Save" to save your changes. It may take a few minutes for GitHub to process your settings and serve your website.

Accessing Your Website

Once GitHub Pages has processed your settings, you can access your website at http://yourusername.github.io. Replace yourusername with your actual GitHub username.

If you've set up a custom domain, it may take some time for the changes to propagate. You can check the status of your custom domain in the "GitHub Pages" section of your repository's settings.

Congratulations! You've successfully deployed your static HTML website to GitHub Pages. Regularly update your website by pushing new changes to the repository. Happy coding!