Answers for "deploy react app to github"

9

Deploying a React App* to GitHub Pages

npm install gh-pages --save-dev
package.json
//...
"homepage": "http://gitname.github.io/react-gh-pages"
//...
"scripts": {
  //...
  "predeploy": "npm run build",
  "deploy": "gh-pages -d build"
}
git init
git remote add origin https://github.com/gitname/react-gh-pages.git
npm run deploy
git add .
git commit -m "Create a React app and publish it to GitHub Pages"
git push origin master
Posted by: Guest on June-21-2021
9

upload react project to github

Make sure you have already created a repo in github.
In "package.json" file of project add - "homepage": "https://username.github.io/reponame"
Run Install - "yarn add gh-pages"
In "package.json/scripts" add `"predeploy":"npm run build", "deploy":"gh-pages -d build"` 
Run "npm run build" to create the build
To push in git use following steps:
1) git init
2) git add -A
3) git commmit -m "first commit"
4) git remote add origin https://github.com/username/reponame.git
5) git push -u origin master
Now in github repo create a new branch "gh-pages"
In settings -> github pages -> source -> branch -> gh-pages -> save
Run "npm run deploy"
*****************************voilà it's done!!*************************
Posted by: Guest on November-10-2020
1

deploy react express to github pages

npm run deploy
Posted by: Guest on January-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language