Skip to content

This repo contains step to step process on how to deploy react app to github pages

Notifications You must be signed in to change notification settings

NSQ1point0/deploy-reactapp-to-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Deploy ReactJS app to GitHub Pages

This repo contains step to step process on how to deploy react app to github pages

Create Github repo

Follow this link to create new repo

Add GitHub Pages dependency package

Install "gh-pages" package using the below command.

npm install gh-pages --save-dev

Add homepage property to package.json file

homepage": "https://{username}.github.io"

package.json example image

Add deploy scripts to package.json file

Add both predeploy and deploy property scripts to the package.json file as below,

"predeploy": "npm run build",
"deploy": "gh-pages -d build"

The "predeploy" command is used to bundle the react application and the "deploy" command helps to deploy the bundled file. package.json deploy example image

Create a remote GitHub repository

..* Initialize the Git using "git init" command. ..* Add it as remote using "git remote add origin your-github-repository-url.git" command.

Deploy the Application to GitHub Pages

Now run the below command to deploy your react application to GitHub Pages.

npm run deploy

Access deployed site

To get the published URL,

..* Go to your GitHub Repo. ..* Click Settings menu.

About

This repo contains step to step process on how to deploy react app to github pages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published