How to Deploy a Vite React App on GitHub | A Simple Guide

Posted by

Vite React App Deploy On GitHub | Step By Step

Vite React App Deploy On GitHub

Deploying a Vite React app on GitHub is a straightforward process. In this article, we will walk through the steps to deploy a Vite React app on GitHub. Let’s get started!

Step 1: Create a Vite React app

If you haven’t already created a Vite React app, you can do so by running the following command:

npx create-vite my-app --template react

Step 2: Create a GitHub repository

Create a new repository on GitHub where you will deploy your Vite React app.

Step 3: Initialize a git repository

Initialize a git repository in your Vite React app by running the following commands:

git init
git add .
git commit -m "Initial commit"

Step 4: Add remote repository

Add your GitHub repository as a remote by running the following command:

git remote add origin https://github.com/your-username/your-repo.git

Step 5: Deploy to GitHub Pages

To deploy your Vite React app on GitHub Pages, you can use the following script in your package.json file:

"scripts": {
  "deploy": "vite build && gh-pages -d dist"
}

Step 6: Deploy your app

Now you can deploy your app to GitHub Pages by running the following command:

npm run deploy

Step 7: Access your deployed app

Once the deployment is complete, you can access your Vite React app by visiting the GitHub Pages URL for your repository.

That’s it! You have successfully deployed your Vite React app on GitHub Pages. You can now share your app with others and showcase your work.

0 0 votes
Article Rating
41 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@ek-developer
6 months ago

Check out my latest video showcasing how to deploy a project with React Router and resolving the 404 error when reloading the page.

@ashimsth5423
6 months ago

how to add custom domain

@gromhellscream5581
6 months ago

It worked for me, thanks a lot bro!

@Winter-clips
6 months ago

A well earned like! You really helped me out!
Much love <3

@pljjy2224
6 months ago

you're my savior

@bantb4245
6 months ago

Thank you, it helps but it can't handle SPA application, where is the history API Fallback, this the most common issue when hosting a SPA application

@Saviya-Hyper
6 months ago

My website show white page

@krokodyl5571
6 months ago

Thanks a lot.

@DARKKNIGHT-qe5bm
6 months ago

my images are not fixed. i did put . before my image source

@henr2000
6 months ago

WOW you saved my life! thanks a lot i was so frustrated like 10 hrs tried different ways and no solutions until now!

@crow707
6 months ago

Legend.

@fuataydin3115
6 months ago

hi, how can i upload from another branch instead of main ?

@HDynasty
6 months ago

This was really helpful. Thank you! Do you have a name for the song playing in the background??

@alexandrab6620
6 months ago

Thank you so much🥰

@girishgirijan9900
6 months ago

Thank you 🙂

@aditideshpande3799
6 months ago

thanks so much!! it saved me today!!

@ShayanDanish-pe2qb
6 months ago

Bro struggled for 2 days, may I have watched your video before. Really Amazing, Concise and Clear!

@user-rg1dn1nt3q
6 months ago

Thanks a lot for the video, i desperately needed it

@louzynerd129
6 months ago

thank you so much man, btw what is the theme you're using in vscode? would love to get the name!

@plantarise8284
6 months ago

I fucking love you man been trying this past 2 days!