How to deploy my react App on github pages

Publishing a React app on GitHub pages(when you have created the app already)
Create a new repository on GitHub.
you have to edit package.json file add the line
"homepage" : "https://username.github.io/repository name"
anywhere
then add the lines 
"predeploy": "npm run build",
"deploy": "gh-pages -d build" 
under the scripts

You must install git in your laptop or pc to execute following steps .
Download link for git:  https://git-scm.com/download

step 1: go to the app folder
step 2: open command prompt
step 3: On command prompt execute npm install gh-pages --save-dev 
step 4: then execute git init 
step 5: then execute git remote add origin https://github.com/username/repositoryname.git
(note: make sure that the repository is empty)
step 6:then execute git add . 
step 7:then execute git commit -m "first commit"
step 8:then execute git push -u origin master
step 9:then execute npm run deploy
you must install git in your windows/Linux/Mac to run the git commands mentioned above.

you can see the deployed app at https://username.github.io/repository name

#deployreactapp
#ongithubpages
#githubpages
#publishingappongithub
#githubrepository
#github
#newrepository
#chanrcr2412
#blogger

Comments

Popular Posts