Deploy HTML CSS JS Website on GitHub Pages: A Step-by-Step Guide

Ann Jul 09, 2026

Deploying a website built with HTML, CSS, and JavaScript on GitHub Pages is a straightforward process that allows you to showcase your work online. GitHub Pages is a static site hosting service that takes HTML files and serves them over the web. Here's a step-by-step guide to help you deploy your website in no time.

Create A Website Like YouTube Using HTML CSS JS | YouTube Clone Website Design Step By Step
Create A Website Like YouTube Using HTML CSS JS | YouTube Clone Website Design Step By Step

Before we dive into the process, ensure you have the following prerequisites: a GitHub account, your HTML, CSS, and JavaScript files ready, and Git installed on your local machine. Let's get started!

18 Exciting HTML and CSS Project Ideas with source code to Level Up Your Web Development Skills
18 Exciting HTML and CSS Project Ideas with source code to Level Up Your Web Development Skills

Setting Up Your GitHub Repository

Your first step is to create a repository on GitHub to host your website.

Html, Css Login Tamplates
Html, Css Login Tamplates

1. Log in to your GitHub account and click the '+' icon in the top-right corner to create a new repository. Name it using the following format: yourusername.github.io, replacing 'yourusername' with your GitHub username. Initialize the repository with a README file and click 'Create repository'.

Cloning Your Repository Locally

HTML, CSS, and JS: A Beginner’s Guide to Web Development
HTML, CSS, and JS: A Beginner’s Guide to Web Development

Next, clone your newly created repository to your local machine using Git.

1. Open your terminal or command prompt and navigate to the directory where you want to clone the repository.

2. Run the following command, replacing 'yourusername' with your GitHub username: git clone https://github.com/yourusername/yourusername.github.io.git

login form html css
login form html css

Adding Your Website Files

Now, add your HTML, CSS, and JavaScript files to the cloned repository.

1. Navigate into the cloned repository folder using the terminal or command prompt.

CSS Notes for Beginners (Easy + Quick Guide) 🎨
CSS Notes for Beginners (Easy + Quick Guide) 🎨

2. Copy your website files into the repository folder. Your HTML file should be named index.html.

Configuring GitHub Pages

the top 10 projects for beginners to practice html and css skills with text
the top 10 projects for beginners to practice html and css skills with text
a computer screen with a pink flower on it
a computer screen with a pink flower on it
html and css login form
html and css login form
#CSS Animations Tips and Tricks
#CSS Animations Tips and Tricks
Coding a Stylish Blog Design Layout in HTML & CSS
Coding a Stylish Blog Design Layout in HTML & CSS
How To Create Text Slider With Pure HTML CSS
How To Create Text Slider With Pure HTML CSS
HTML5 AND CSS FOR WEB DEVELOPMENT EASY | Website Making
HTML5 AND CSS FOR WEB DEVELOPMENT EASY | Website Making
How To Create An Animated Message With HTML, CSS, And JavaScript
How To Create An Animated Message With HTML, CSS, And JavaScript
HTML + CSS Cheat Sheet (One Page) πŸ’»
HTML + CSS Cheat Sheet (One Page) πŸ’»
18 HTML & CSS Projects for Web Design Beginners πŸŽ¨πŸ’»
18 HTML & CSS Projects for Web Design Beginners πŸŽ¨πŸ’»
How To Create Overlaping Elements In HTML & CSS
How To Create Overlaping Elements In HTML & CSS
Excellent Way to Centre div, CSS
Excellent Way to Centre div, 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
🌍 Designing, Building, and Publishing Websites
🌍 Designing, Building, and Publishing Websites
Simple Website Layout using HTML CSS
Simple Website Layout using HTML CSS
This CSS Animation Will Instantly Upgrade Your Website πŸš€ (Pure HTML & CSS)
This CSS Animation Will Instantly Upgrade Your Website πŸš€ (Pure HTML & CSS)
an image with the text how to place text over image in html css
an image with the text how to place text over image in html css
CSS button animation
CSS button animation
5 Best Code Editors for HTML & CSS Beginners in 2025 – Easy & Powerful Tools
5 Best Code Editors for HTML & CSS Beginners in 2025 – Easy & Powerful Tools
Blinking Text Using HTML and CSS
Blinking Text Using HTML and CSS

To set up GitHub Pages, you need to create a special file called CNAME (optional but recommended) and a .gitignore file to exclude certain files from being tracked by Git.

Creating the CNAME File

The CNAME file allows you to use a custom domain for your GitHub Pages site. Create a new file named CNAME (all caps) in the root of your repository and add your custom domain (e.g., www.yourdomain.com).

Creating the .gitignore File

Create a new file named .gitignore in the root of your repository and add the following lines to exclude node_modules and .DS_Store files from being tracked by Git:

node_modules/
.DS_Store

Pushing Your Changes to GitHub

Finally, push your changes to the GitHub repository.

Adding and Committing Changes

1. Add your changes to the Git repository using the command: git add .

2. Commit the changes with a meaningful commit message, e.g., git commit -m "Initial commit of my website"

Pushing Changes to GitHub

1. Push your changes to the GitHub repository using the command: git push -u origin main

Congratulations! Your website is now live on GitHub Pages. You can view it by navigating to https://yourusername.github.io in your web browser. To make updates to your website, simply repeat the process of adding, committing, and pushing changes to your GitHub repository.

Happy coding! Now that your website is live, consider exploring other features and customization options offered by GitHub Pages to make your online presence truly unique. Keep learning and building amazing things!