Skip to content

Instantly share code, notes, and snippets.

@vre2h
Last active March 4, 2024 15:06
Show Gist options
  • Save vre2h/da9db3733c238c174d13670fb77c1f1a to your computer and use it in GitHub Desktop.
Save vre2h/da9db3733c238c174d13670fb77c1f1a to your computer and use it in GitHub Desktop.
Simple guide for deploying your react app to Github-Pages.
  1. Your package.json file should consist a field homepage:
  "homepage": "https://<github-username>.github.io/<project-repo>"

2.1. Install gh-pages via npm:

  npm i --save-dev gh-pages

2.2. Or yarn:

  yarn add --dev gh-pages

3.1. Add new script to package.json via yarn:

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

3.2. Or npm:

    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
@MitkaZ7
Copy link

MitkaZ7 commented Sep 7, 2021

Thanx!

@romfe
Copy link

romfe commented Oct 12, 2021

Thanks

@Aribs01
Copy link

Aribs01 commented Nov 13, 2021

thanks for this

@RenanS80
Copy link

Thank u!

@hughesmarissa
Copy link

thank you

@BaseMax
Copy link

BaseMax commented Apr 8, 2022

Thanks.

@appistore
Copy link

Thanks

@prlak
Copy link

prlak commented Jul 25, 2022

Thanks much!

@creaktive
Copy link

Thanks!

@Traigel
Copy link

Traigel commented Aug 27, 2022

Thanks

@gerwld
Copy link

gerwld commented Nov 12, 2022

Thanks

@ghughes13
Copy link

Is there a way to do it without homepage? Trying to host something on github and netlify but netlify won't work with
"homepage": "https://<github-username>.github.io/<project-repo>"

@jhonshua
Copy link

tanks....muchas gracias

@Jaimesanchezgalvis
Copy link

thank a lot.

@HamzaOztrk
Copy link

thanks

@ShiyuanLin
Copy link

Thanks!

@jaywilliamsapar
Copy link

🔥🔥🔥 Thanks you so much

@jamesdev4you
Copy link

awesome perfect should be favorited by everyone lol

@melanieepearl
Copy link

thanks!

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