By Sply Code | May 6, 2025
Follow Us on
How to Deploy a Website on GitHub Pages for Free
Want to get your website online for free? GitHub Pages offers a simple way to publish static websites directly from
your GitHub repository. Whether you're a beginner or an experienced developer, it's a great option for portfolios,
documentation, and personal projects. Here's a step-by-step guide to help you deploy your site.
What is GitHub Pages?
GitHub Pages is a free web hosting service provided by GitHub that allows you to host HTML, CSS, and JavaScript files
directly from a GitHub repository. It's ideal for static websites and supports custom domains and HTTPS.
Step 1: Create a GitHub Repository
- Go to github.com and sign in.
- Click the "+" icon and select "New repository".
- Name your repository (e.g.,
my-website
).
- Check "Add a README file".
- Click "Create repository".
Step 2: Add Your Website Files
You can do this in two ways:
Upload via GitHub Interface:
- Click "Add file > Upload files".
- Drag and drop your HTML, CSS, and JavaScript files.
Use Git on Your PC:
git clone https://github.com/yourusername/my-website.git
cd my-website
# Copy your files into this folder
git add .
git commit -m "Add website files"
git push origin main
Step 3: Enable GitHub Pages
- Go to your repository.
- Click on "Settings" > "Pages" in the sidebar.
- Under "Source", choose "main" branch and click "Save".
- Your website will be published at
https://yourusername.github.io/my-website/
.
Step 4 (Optional): Use a Custom Domain
- Register a domain name.
- In your DNS settings, add a CNAME record pointing to your GitHub Pages URL.
- In your repository, create a
CNAME
file with your custom domain (e.g., www.yoursite.com
).
Benefits of GitHub Pages
- Completely free
- Built-in HTTPS
- Custom domain support
- Fast and reliable
- Perfect for developers and students
GitHub Pages is one of the best ways to host a simple website for free. With just a few steps, you can have your
personal site live on the web. It’s fast, easy, and perfect for learning or showcasing your work.