Skip to content

Instantly share code, notes, and snippets.

@jsohndata
Last active March 5, 2023 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsohndata/628495b65d574fc53430f1008dc260cb to your computer and use it in GitHub Desktop.
Save jsohndata/628495b65d574fc53430f1008dc260cb to your computer and use it in GitHub Desktop.
Deploying React App on GitHub Pages

Deploying React App on GitHub Pages

This note is for those who already have a repo and ready to publish. To see the source material or more in-depth please see below.

1) Install

npm install -g gh-pages

Note: I'm going to install gobally to create a shell script below 2.2


2) Edit package.json

After "version" add...

"homepage": https://{YOUR-git-name}.github.io/{YOUR-repo-name}

3) Git push

Add, commit and push to your repo.


4) Go to GitHub Page

  • Click on the Settings (Cog icon), then select Pages on the side panel.
  • In the GitHub Pages I selected the following.
    • Source: Deploy from a branch
    • Branch: gh-pages => /(root)

Source

github.com/gitname/react-gh-pages

npmjs.com/package/gh-pages

@jsohndata
Copy link
Author

Thanks @taroche!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment