Deploy HTML Code on GitHub: A Step-by-Step Guide

Ann Jul 09, 2026

Embarking on your coding journey? You've probably heard about GitHub, the world's leading platform for version control and collaboration. But did you know you can deploy HTML code directly from GitHub? Let's dive into a step-by-step guide to help you showcase your HTML skills seamlessly.

Host Websites Free with GitHub Pages 🚀💻
Host Websites Free with GitHub Pages 🚀💻

Before we begin, ensure you have a GitHub account and a repository ready. If you're new to GitHub, don't worry - we'll keep it simple and intuitive. Let's get started!

GitHub Complete Beginner Guide (2026) | Learn Git & GitHub Step-by-Step
GitHub Complete Beginner Guide (2026) | Learn Git & GitHub Step-by-Step

Setting Up Your Repository

First, let's ensure your repository is set up correctly to host your HTML files.

GitHub Basics Tutorial - How to Use GitHub
GitHub Basics Tutorial - How to Use GitHub

1. Create a new repository on GitHub. Name it something relevant to your project, like 'my-website'.

Initializing the Local Repository

Git and GitHub Commands PDF - Complete Guide for Beginners to Pro🚀💻  #git #command #code
Git and GitHub Commands PDF - Complete Guide for Beginners to Pro🚀💻 #git #command #code

Now, let's initialize a local Git repository on your computer where you'll store your HTML files.

2. Open your terminal or command prompt, navigate to the directory where you want to create your project, and type:

git init

This command initializes a new Git repository. Your project is now ready to track changes.

Push Code to GitHub Explained 🚀
Push Code to GitHub Explained 🚀

Connecting Local to Remote Repository

Next, we'll connect your local repository to the remote one on GitHub.

3. Copy the repository URL from your GitHub repository page. It should look something like this: https://github.com/yourusername/my-website.git

the github chat sheet is displayed in this screenshote screen graber
the github chat sheet is displayed in this screenshote screen graber

4. In your terminal, type:

git remote add origin YOUR_REPO_URL

Replace YOUR_REPO_URL with the URL you copied earlier. This command connects your local repository to the remote one on GitHub.

#git #github #versioncontrol #interviewpreparation #softwaredevelopment #devops #learningjourney #sdet #qatesting | Satya Tharun Manikanta Nalle
#git #github #versioncontrol #interviewpreparation #softwaredevelopment #devops #learningjourney #sdet #qatesting | Satya Tharun Manikanta Nalle
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 '
Github Cheatsheet
Github Cheatsheet
an image of a web page with the text'html input types'on it
an image of a web page with the text'html input types'on it
Git & GitHub Explained for Beginners (2026)
Git & GitHub Explained for Beginners (2026)
Beginner’s Guide to Getting Started with GitHub in 2025 – Easy Step-by-Step Tutorial
Beginner’s Guide to Getting Started with GitHub in 2025 – Easy Step-by-Step Tutorial
Git Cheat Sheet 🔥 | Essential Git Commands Every Developer Should Know
Git Cheat Sheet 🔥 | Essential Git Commands Every Developer Should Know
git commit Explained (Day 6 Git Guide)
git commit Explained (Day 6 Git Guide)
the github chat sheet is displayed in pink and black
the github chat sheet is displayed in pink and black
15 GITHUB FEATURES EVERY DEVELOPER SHOULD USE
15 GITHUB FEATURES EVERY DEVELOPER SHOULD USE
What Is GitHub? Ultimate Guide on How to Use GitHub in 2023
What Is GitHub? Ultimate Guide on How to Use GitHub in 2023
What is Git & GitHub? A Complete Guide for Beginners 👨‍💻
What is Git & GitHub? A Complete Guide for Beginners 👨‍💻
Git vs GitHub Explained (Day 24 Git Guide)
Git vs GitHub Explained (Day 24 Git Guide)
a laptop computer sitting on top of a wooden desk next to a cup of coffee
a laptop computer sitting on top of a wooden desk next to a cup of coffee
Git & GitHub Cheat Sheet for Beginners
Git & GitHub Cheat Sheet for Beginners
Git Vs Github
Git Vs Github
a table that has some type of text in red and black on the bottom right hand corner
a table that has some type of text in red and black on the bottom right hand corner
Basic Of HTML | Web Development | Programming
Basic Of HTML | Web Development | Programming
How To Create A GitHub Repository In This Easy Step-by-step Guide For Beginners.
How To Create A GitHub Repository In This Easy Step-by-step Guide For Beginners.
HTML Concepts guide—your go-to resource for supercharging your coding skills
HTML Concepts guide—your go-to resource for supercharging your coding skills

Adding Your HTML Code

Now that your repository is set up, let's add your HTML code.

1. Create a new file in your project directory. Name it 'index.html'.

2. Open this file in your preferred text editor or IDE and write your HTML code. For example:

<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome to my website!</h1>
</body>
</html>

3. Save the file and close it.

Staging and Committing Your Changes

Now, let's stage and commit your changes so Git can track them.

4. In your terminal, type:

git add .
git commit -m "Initial commit"

The first command stages your changes, and the second command commits them with a message "Initial commit".

Pushing Your Changes to GitHub

Finally, let's push your changes to the remote repository on GitHub.

5. Type:

git push -u origin main

This command pushes your changes to the 'main' branch of your remote repository. If you're using another branch, replace 'main' with your branch name.

Deploying Your HTML Code

GitHub provides a simple way to host your HTML files. Let's set it up.

1. Go to your repository page on GitHub.

2. Click on the 'Settings' tab at the top of the page.

Setting the Main Page

Now, let's set your 'index.html' file as the main page.

3. Scroll down to the 'Pages' section. Under 'Source', select 'main' and click 'Save'.

4. It may take a few minutes for GitHub to deploy your site. Once it's live, you'll see a message with a link to your website.

Viewing Your Deployed HTML Code

5. Click on the link to view your deployed HTML code. You should see your website live on the internet!

Congratulations! You've successfully deployed your HTML code on GitHub. Now, every time you push changes to your repository, GitHub will automatically update your live website. Happy coding!