Deploy your React App on Github in 5 minutes

1.
At your app root directory, run the command:

npm install gh-pages

2. Publish your app to GitHub:

Ether button is OK.
Ignore this step if you have already published your app

3. Add the following to the first line of package.json…


This content originally appeared on DEV Community and was authored by Yongchang He

  • 1. At your app root directory, run the command:
npm install gh-pages
  • 2. Publish your app to GitHub:

Ether button is OK.
Ignore this step if you have already published your app

Image description

  • 3. Add the following to the first line of package.json:

"homepage": "https://GIT_USERNAME.github.io/REPOSITORY_NAME",

For the URL string, you will need to replace it with your git user name and your current repository name.
TIPS: click the gear icon on the GitHub page, and the URL will show up:

Image description

Image description

  • 4. Add the following in "scripts" in package.json:

"predeploy":"npm run build",

"deploy":"gh-pages -d build",

Image description

  • 5. Save the app and commit the change to update your remote repo.

Alternatively, you can directly update your JSON file on the GitHub webpage and commit changes.

  • 6. Deploy the app by running:
npm run deploy

Image description

After the deployment, some changes exist. Just commit these changes again.

  • 7. Find your app URL at General > Pages:

Image description

Image description

  • 8. Have fun!~

This is my React app Demo I used for this tutorial and welcome to play
Git Repo for this game

Image description

Reference

Cover Page from:
https://akhtarvahid.medium.com/setup-git-and-deploy-react-app-to-github-pages-7b5c4180fdaf


This content originally appeared on DEV Community and was authored by Yongchang He


Print Share Comment Cite Upload Translate Updates
APA

Yongchang He | Sciencx (2022-06-27T15:24:55+00:00) Deploy your React App on Github in 5 minutes. Retrieved from https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/

MLA
" » Deploy your React App on Github in 5 minutes." Yongchang He | Sciencx - Monday June 27, 2022, https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/
HARVARD
Yongchang He | Sciencx Monday June 27, 2022 » Deploy your React App on Github in 5 minutes., viewed ,<https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/>
VANCOUVER
Yongchang He | Sciencx - » Deploy your React App on Github in 5 minutes. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/
CHICAGO
" » Deploy your React App on Github in 5 minutes." Yongchang He | Sciencx - Accessed . https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/
IEEE
" » Deploy your React App on Github in 5 minutes." Yongchang He | Sciencx [Online]. Available: https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/. [Accessed: ]
rf:citation
» Deploy your React App on Github in 5 minutes | Yongchang He | Sciencx | https://www.scien.cx/2022/06/27/deploy-your-react-app-on-github-in-5-minutes/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.