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
10 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
10 months ago

how to add custom domain

@gromhellscream5581
10 months ago

It worked for me, thanks a lot bro!

@Winter-clips
10 months ago

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

@pljjy2224
10 months ago

you're my savior

@bantb4245
10 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
10 months ago

My website show white page

@krokodyl5571
10 months ago

Thanks a lot.

@DARKKNIGHT-qe5bm
10 months ago

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

@henr2000
10 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
10 months ago

Legend.

@fuataydin3115
10 months ago

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

@HDynasty
10 months ago

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

@alexandrab6620
10 months ago

Thank you so much🥰

@girishgirijan9900
10 months ago

Thank you 🙂

@aditideshpande3799
10 months ago

thanks so much!! it saved me today!!

@ShayanDanish-pe2qb
10 months ago

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

@user-rg1dn1nt3q
10 months ago

Thanks a lot for the video, i desperately needed it

@louzynerd129
10 months ago

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

@plantarise8284
10 months ago

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