Upload HTML to GitHub Pages: A Step-by-Step Guide

Ann Jul 09, 2026

Uploading HTML to GitHub Pages is a straightforward process that allows you to host your website directly from your GitHub repository. This not only makes your website easily accessible but also enables version control and collaboration. Let's dive into the step-by-step guide to help you get started.

How to Upload A Website To GitHub (EASY Method!)
How to Upload A Website To GitHub (EASY Method!)

Before we begin, ensure you have the following: a GitHub account, a local HTML file (or files) for your website, and Git installed on your computer. If you haven't installed Git, you can download it from the official Git website.

How to Upload Your Startup Website to GitHub Pages
How to Upload Your Startup Website to GitHub Pages

Setting Up Your GitHub Pages Repository

First, let's create a repository on GitHub that will host your HTML files.

Host Your Website FREE on GitHub in 60 Seconds!
Host Your Website FREE on GitHub in 60 Seconds!

1. Log in to your GitHub account and click on the '+' icon in the top-right corner. Select 'New repository'.

Naming Your Repository

How to Upload Jekyll to Github Page
How to Upload Jekyll to Github Page

Name your repository using the following format: yourusername.github.io, replacing 'yourusername' with your GitHub username. This is crucial for GitHub Pages to recognize your repository as a website.

For example, if your GitHub username is 'johndoe', your repository name should be 'johndoe.github.io'.

Initializing Your Local Repository

How to upload files in GitHub
How to upload files in GitHub

Now, let's initialize a local Git repository on your computer where your HTML files are stored.

1. Open your terminal or command prompt and navigate to the directory containing your HTML files.

2. Initialize a new Git repository by typing 'git init' and pressing Enter.

How to upload a project to GitHub
How to upload a project to GitHub

Connecting Your Local Repository to GitHub

Next, we'll connect your local repository to your GitHub repository.

a person pointing at a computer screen with the words build and host your website free on github
a person pointing at a computer screen with the words build and host your website free on github
Upload an Existing File to GitHub
Upload an Existing File to GitHub
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 '
login form html css
login form html css
Embedding Images in HTML using <img>
Embedding Images in HTML using <img>
two screens showing different types of web pages
two screens showing different types of web pages
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
Easiest Way to Upload ANY Project on GitHub in 1 Click! ‪@AdeebTechLab‬
Easiest Way to Upload ANY Project on GitHub in 1 Click! ‪@AdeebTechLab‬
File Drag & Drop Upload In HTML Javascript
File Drag & Drop Upload In HTML Javascript
Automated Org Mode Website Publishing with GitHub or SourceHut
Automated Org Mode Website Publishing with GitHub or SourceHut
add this image upload ui to your website
add this image upload ui to your website
HTML Document Structure
HTML Document Structure
Modern GitHub Profile UI
Modern GitHub Profile UI
Responsive Animated Login and Signup Page with HTML CSS And JavaScript
Responsive Animated Login and Signup Page with HTML CSS And JavaScript
✅ Create Lists in HTML
✅ Create Lists in HTML
Html, Css Login Tamplates
Html, Css Login Tamplates
the github chat sheet is displayed in this screenshote screen graber
the github chat sheet is displayed in this screenshote screen graber
Gitflow on GitHub: How to use Git Flow workflows with GitHub Based Repos
Gitflow on GitHub: How to use Git Flow workflows with GitHub Based Repos

1. Add your files to Git using the command 'git add .'. The dot (.) represents the current directory.

Committing Your Changes

After adding your files, you need to commit them with a meaningful commit message.

1. Type 'git commit -m "Your commit message"' and press Enter. For example, 'git commit -m "Initial commit of my website"'.

Pushing Your Changes to GitHub

Now, let's push your committed changes to your GitHub repository.

1. Type 'git remote add origin https://github.com/yourusername/yourusername.github.io.git' and press Enter. Replace 'yourusername' with your GitHub username.

2. Type 'git push -u origin main' and press Enter. This will push your local changes to the main branch of your GitHub repository.

Enabling GitHub Pages

Finally, we need to enable GitHub Pages for your repository.

1. Go to your GitHub repository and click on the 'Settings' tab at the top.

Selecting the Source

Under the 'GitHub Pages' section, select 'main' (or 'master', depending on your default branch) in the 'Source' dropdown menu.

1. Click 'Save'.

Accessing Your Live Website

After a few moments, your website should be live at 'https://yourusername.github.io'.

Congratulations! You've successfully uploaded your HTML to GitHub Pages. Now, every time you want to update your website, simply push your changes to the main branch of your GitHub repository.

Remember, GitHub Pages is a static site host, meaning it only serves static files. If you need dynamic functionality, you might want to consider using a different hosting service or setting up a custom domain with GitHub Pages.