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.
Check out my latest video showcasing how to deploy a project with React Router and resolving the 404 error when reloading the page.
how to add custom domain
It worked for me, thanks a lot bro!
A well earned like! You really helped me out!
Much love <3
you're my savior
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
My website show white page
Thanks a lot.
my images are not fixed. i did put . before my image source
WOW you saved my life! thanks a lot i was so frustrated like 10 hrs tried different ways and no solutions until now!
Legend.
hi, how can i upload from another branch instead of main ?
This was really helpful. Thank you! Do you have a name for the song playing in the background??
Thank you so much🥰
Thank you 🙂
thanks so much!! it saved me today!!
Bro struggled for 2 days, may I have watched your video before. Really Amazing, Concise and Clear!
Thanks a lot for the video, i desperately needed it
thank you so much man, btw what is the theme you're using in vscode? would love to get the name!
I fucking love you man been trying this past 2 days!