🚀 How to Deploy a Website on GitHub Pages

Learn about Git and the steps to host your static site for free.

📌 What is Git?

Git is a version control system that helps you track changes in your code, collaborate with others, and manage different versions of your project. It allows you to:

📌 Why Use GitHub Pages?

GitHub Pages lets you host static websites (HTML, CSS, JavaScript) directly from your GitHub repository — completely free, no servers needed.

Step 1: Create a GitHub Repository

Go to GitHub → Click New → Name your repo (e.g., mywebsite.github.io) → Set it to Public → Click Create Repository.

Step 2: Add Your Website Files

Put your index.html, style.css, and other files into the local folder.

Step 3: Push to GitHub

git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/yourusername/mywebsite.github.io.git
git push -u origin main
            

Step 4: Enable GitHub Pages

Go to your repo → SettingsPages → Select branch main and folder root → Click Save.

Step 5: Visit Your Website

Wait a minute and open:
https://yourusername.github.io