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

Ann Jul 09, 2026

Deploying a website built with HTML, CSS, and JavaScript to GitHub can make your project easily accessible to the world. GitHub Pages, a static site hosting service, allows you to host your personal or project website directly from a GitHub repository. Here's a step-by-step guide to help you achieve this.

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

Before we begin, ensure you have the following: a GitHub account, your HTML, CSS, and JavaScript files ready, and a basic understanding of Git and GitHub.

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

Setting Up Your GitHub Repository

First, create a new repository on GitHub. Name it something like 'yourusername.github.io', replacing 'yourusername' with your actual GitHub username. This will be the URL where your site lives.

Html, Css Login Tamplates
Html, Css Login Tamplates

Next, clone this new repository to your local machine using the command: `git clone https://github.com/yourusername/yourusername.github.io.git`. Replace 'yourusername' with your actual GitHub username.

Organizing Your Project Files

login form html css
login form html css

Navigate into your new repository folder and organize your project files. The root of your repository should contain your HTML file (e.g., index.html), with your CSS and JavaScript files in their respective folders (e.g., css and js).

Your folder structure might look like this: ``` yourusername.github.io/ |-- index.html |-- css/ | |-- style.css |-- js/ | |-- script.js `-- CNAME (optional, for custom domains) ```

Committing and Pushing Your Changes

a computer screen with a pink flower on it
a computer screen with a pink flower on it

Initialize Git in your project folder with `git init`, then add your files with `git add .`. Commit your changes with a meaningful commit message, like "Initial commit". Finally, push your changes to GitHub with `git push -u origin main`.

Your website should now be live at .

Customizing Your GitHub Pages Site

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

GitHub Pages supports custom domains. To use one, you'll need to update your repository settings and add a CNAME file.

Updating Repository Settings

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
#CSS Animations Tips and Tricks
#CSS Animations Tips and Tricks
HTML, CSS, and JS: A Beginner’s Guide to Web Development
HTML, CSS, and JS: A Beginner’s Guide to Web Development
html and css login form
html and css login form
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
How To Create Text Slider With Pure HTML CSS
How To Create Text Slider With Pure HTML CSS
CSS button animation
CSS button animation
the four ways to add css in your web page or email address info sheet
the four ways to add css in your web page or email address info sheet
🎨 3 Ways to Add CSS | Inline, Internal & External CSS Explained
🎨 3 Ways to Add CSS | Inline, Internal & External CSS Explained
How To Create An Animated Message With HTML, CSS, And JavaScript
How To Create An Animated Message With HTML, CSS, And JavaScript
HTML5 AND CSS FOR WEB DEVELOPMENT EASY | Website Making
HTML5 AND CSS FOR WEB DEVELOPMENT EASY | Website Making
Blinking Text Using HTML and CSS
Blinking Text Using HTML and CSS
How To Create Overlaping Elements In HTML & CSS
How To Create Overlaping Elements In HTML & CSS
Master Css Using These Websites..
Master Css Using These Websites..
Very Simple HTML CSS Image Gallery
Very Simple HTML CSS Image Gallery
Website cupcake design using html and css.mp4
Website cupcake design using html and css.mp4
18 HTML & CSS Projects for Web Design Beginners 🎨💻
18 HTML & CSS Projects for Web Design Beginners 🎨💻
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
Design Elements in HTML & CSS
Design Elements in HTML & CSS

In your repository, go to the 'Settings' tab. Scroll down to the 'GitHub Pages' section. Select 'main' (or your primary branch) as the source, and click 'Save'.

Your site should now be live at .

Adding a CNAME File

Create a new file in your repository root named 'CNAME'. Add your custom domain (e.g., 'yourdomain.com') to this file, and commit the changes. Push these changes to GitHub.

It may take a few minutes for your custom domain to propagate. Once it does, your site will be live at .

Congratulations! You've successfully deployed your HTML, CSS, and JavaScript website to GitHub. Now, you can easily update your site by making changes to your local files, committing them, and pushing to GitHub. Happy coding!