Skip to main content

🚀 How to Deploy Your Vue.js App to GitHub Pages (Free Hosting Tutorial)



Are you ready to take your Vue.js project live — without paying a single cent on hosting? Whether you're building a portfolio, a frontend prototype, or a mini web app, GitHub Pages offers a fast and free solution to host your Vue.js project.

In this guide, we’ll walk you through how to deploy a Vue.js app to GitHub Pages, including essential setup, deployment steps, troubleshooting, and best practices — even if you're a beginner.


 Why Choose GitHub Pages for Your Vue App?

GitHub Pages is a free static site hosting service powered by GitHub. It allows you to host HTML, CSS, and JavaScript files directly from your repository.

Here’s why it's a perfect match for Vue.js apps:

  • Free: No hosting fees or credit card required.

  • Easy to Use: Simple configuration and fast deployment.

  • Git-Powered: Automatically links to your GitHub repository.

  • Great for SPAs: Works well with Vue apps that don’t require server-side rendering.

  • Ideal for Beginners: No need for complex hosting setups or deployment pipelines.

If you're building something like a portfolio site, landing page, or a Vue-powered documentation app, GitHub Pages is an excellent option.


Prefer to Watch Instead?

I’ve created a complete YouTube video that shows everything step-by-step — from initializing your Vue.js project to going live on GitHub Pages.

📺 Make sure to Like and Subscribe if you find it helpful!


 What You’ll Learn in This Guide

By the end of this tutorial, you’ll understand:

  • How to prepare your Vue app for deployment

  • How to use the gh-pages package to push your app live

  • How to configure package.json and vue.config.js correctly

  • How to fix common issues like 404s and routing problems


 Step-by-Step Deployment Instructions

Step 1: Build Your Vue Project

Run the following command to create a production-ready version of your app:

npm run build

This will generate a dist/ folder with all the compiled static files needed for deployment.


Step 2: Install gh-pages

The gh-pages package allows you to deploy static files to GitHub Pages effortlessly.

npm install --save-dev gh-pages

 Step 3: Configure Your package.json

Add the following lines to your package.json file:

"homepage": "https://your-username.github.io/your-repo",
"scripts": {
"build": "vue-cli-service build",
"deploy": "gh-pages -d dist"
}

Note:
  • Replace your-username and your-repo with your actual GitHub username and repo name.

  • The homepage value helps Vue generate correct relative paths during the build process.


Step 4: Create or Update vue.config.js

If it doesn't already exist, create a vue.config.js file in the root of your project and add:

module.exports = {
publicPath: './'
}
This tells Vue to use relative paths when building the app, which is necessary for GitHub Pages to render the app correctly.

Step 5: Push to GitHub & Deploy

Make sure your local project is pushed to GitHub:

git add .
git commit -m "Prepare for GitHub Pages deployment"
git push origin main

Then, deploy your app with:

npm run deploy

🎉 That’s it! Your app will be live at:

https://your-username.github.io/your-repo/

 Common Issues and How to Fix Them

404 or Blank Page After Deployment

Fixes:

  • Ensure your publicPath in vue.config.js is set correctly to './' or '/your-repo/'.

  • Make sure npm run build was run before npm run deploy.

  • Confirm that your gh-pages branch exists and contains the built files.

  • Wait a few minutes; GitHub Pages can take some time to go live.


 Best Practices and Tips

  • Use README.md: Add a README to your repo for documentation or links.

  • Use a .gitignore: Keep your repo clean and exclude node_modules, dist, etc.

  • Enable GitHub Pages: Double-check it's enabled under your repo settings > Pages.

  • Branch setup: You can configure GitHub Pages to serve from the gh-pages branch or /docs folder — but gh-pages + gh-pages package is easiest for Vue apps.

  • Auto-deploy with GitHub Actions (Advanced): You can automate deployment on every push using GitHub Actions CI/CD.


 Useful Resources

 Have Questions or Need Help?

Feel free to:

  • Comment on the YouTube tutorial

  • Reach out via the contact form on this blog

  • Drop your GitHub repo link and I can take a quick look!


Final Thoughts

Deploying your Vue.js app to GitHub Pages is one of the easiest and most cost-effective ways to get your work online. It’s perfect for demos, learning projects, and portfolios.

Now that you know how to:

  • Build and prepare your app for deployment

  • Configure the right settings

  • Troubleshoot common issues

…you’re well-equipped to share your Vue project with the world!


 If You Found This Helpful

  •  Like & Subscribe on YouTube

  •  Share this article with fellow Vue developers

  • Bookmark it for your next project

Thanks for reading, and happy coding! 🙌


Vue.js GitHub Pages Deployment, Free Vue Hosting, How to Deploy Vue.js, Vue CLI GitHub, Vue gh-pages, Host Vue App Free, Vue.js Portfolio Hosting, Frontend Deployment 2025, Vue Static Website, Vue Single Page App Deploy



#VueJS #GitHubPages #FrontendDevelopment #WebDevelopment #FreeHosting #LaeTechBank #VueDeploy

Comments

Popular posts from this blog

Build a Complete Full-Stack Web App with Vue.js, Node.js & MySQL – Step-by-Step Guide

📅 Published on: July 2, 2025 👨‍💻 By: Lae's TechBank  Ready to Become a Full-Stack Web Developer? Are you looking to take your web development skills to the next level? In this in-depth, beginner-friendly guide, you’ll learn how to build a complete full-stack web application using modern and popular technologies: Frontend: Vue.js (Vue CLI) Backend: Node.js with Express Database: MySQL API Communication: Axios Styling: Custom CSS with Dark Mode Support Whether you’re a frontend developer exploring the backend world or a student building real-world portfolio projects, this tutorial is designed to guide you step by step from start to finish. 🎬 Watch the Full Video Tutorials 👉 Full Stack Development Tutorial on YouTube 👉 Backend Development with Node.js + MySQL 🧠 What You’ll Learn in This Full Stack Tutorial How to set up a Vue.js 3 project using Vue CLI Using Axios to make real-time API calls from frontend Setting up a secure b...

🧠 What Is Frontend Development? A Beginner-Friendly Guide to How Websites Work

🎨 What is Frontend Development? A Beginner’s Guide to the Web You See Date: July 2025 Ever wondered how websites look so beautiful, interactive, and responsive on your screen? From the buttons you click to the forms you fill out and the animations that pop up — all of that is the work of a frontend developer. In this blog post, we’ll break down everything you need to know about frontend development:  What frontend development is  The core technologies behind it  Real-life examples you interact with daily Tools used by frontend developers  How to start learning it — even as a complete beginner 🌐 What Is the Frontend? The frontend is the part of a website or web application that users see and interact with directly. It’s often referred to as the "client-side" of the web. Everything you experience on a website — layout, typography, images, menus, sliders, buttons — is crafted using frontend code. In simpler terms: If a website were a the...