How to Deploy Your Website on GitHub Pages and Add a Custom Domain
Step-by-step guide to deploying your website on GitHub Pages and making it professional with a custom domain.
Launching a website is an exciting step in establishing your online presence, but it can also be a daunting process, especially if you’re new to web development and hosting. Thankfully, GitHub Pages provides an easy and free solution for hosting your website, and you can even use a custom domain to make it more professional.
In this guide, we’ll walk through the steps to deploy your website on GitHub Pages and manage DNS records for a custom domain.
✅ Prerequisites
Before starting, make sure you have:
- A GitHub account (sign up here if you don’t have one).
- A GitHub repository containing your website’s source code.
- A custom domain (from GoDaddy, Namecheap, Google Domains, etc.).
🚀 Deploying Your Website on GitHub Pages
-
Create a Repository
- Name it in the format:
yourusername.github.io
- Name it in the format:
-
Upload Website Files
- Push your website source code to the repo.
- Ensure the entry file is
index.html.
-
Enable GitHub Pages
- Go to Settings > Pages.
- Select the branch (
mainormaster) and save.
-
Wait for Deployment
- GitHub will build and deploy your site automatically.
-
Access Your Website
- Open:
https://yourusername.github.io
- Open:
🌍 Adding a Custom Domain
-
Purchase a Domain
- From a registrar (e.g., GoDaddy, Namecheap).
-
Update DNS Records
-
Login to your registrar’s DNS management.
-
Add A Records pointing to GitHub’s IPs:
Record Type Host Value A @ 185.199.108.153 A @ 185.199.109.153 A @ 185.199.110.153 A @ 185.199.111.153 -
Add a CNAME Record:
Host: www Value: yourusername.github.io
-
-
Configure GitHub Repository
- Go to Settings > Pages > Custom Domain.
- Enter your domain (e.g.,
www.svivek.tech) and save.
-
Wait for DNS Propagation
- Changes may take up to 48 hours.
-
Verify Your Domain
- Visit
www.yourdomain.comto confirm it works.
- Visit
🎉 Conclusion
Deploying your website on GitHub Pages and adding a custom domain is a simple yet powerful way to showcase your work to the world.
👉 Check out my portfolio at www.svivek.tech for examples of my projects.
Feel free to reach out if you need help on your web development journey. 🚀