1npm install gh-pages --save-dev
2package.json
3//...
4"homepage": "http://gitname.github.io/react-gh-pages"
5//...
6"scripts": {
7 //...
8 "predeploy": "npm run build",
9 "deploy": "gh-pages -d build"
10}
11git init
12git remote add origin https://github.com/gitname/react-gh-pages.git
13npm run deploy
14git add .
15git commit -m "Create a React app and publish it to GitHub Pages"
16git push origin master
1Make sure you have already created a repo in github.
2In "package.json" file of project add - "homepage": "https://username.github.io/reponame"
3Run Install - "yarn add gh-pages"
4In "package.json/scripts" add `"predeploy":"npm run build", "deploy":"gh-pages -d build"`
5Run "npm run build" to create the build
6To push in git use following steps:
71) git init
82) git add -A
93) git commmit -m "first commit"
104) git remote add origin https://github.com/username/reponame.git
115) git push -u origin master
12Now in github repo create a new branch "gh-pages"
13In settings -> github pages -> source -> branch -> gh-pages -> save
14Run "npm run deploy"
15*****************************voilà it's done!!*************************
1npm install gh-pages --save-dev
2package.json
3//...
4"homepage": "http://gitname.github.io/react-gh-pages"
5//...
6"scripts": {
7 //...
8 "predeploy": "npm run build",
9 "deploy": "gh-pages -d build"
10}
11git init