Member-only story

How to deploy React Github pages

YvonneDev
Jan 7, 2021

--

Photo by Richy Great on Unsplash
  1. command line: direct to your project name position
cd <project name>

2.go to your GitHub to build a new repository

you can find the HTTPS or SSH on the right side in the code button

3.command line: add local project files remotely to GitHub location

git remote add origin <https url>

4.change the package.json file:

add “homepage”,”predeploy” and “deploy”

5.run the command line to deploy

yarn deploygit add .
git commit -m 'deploy pages to github'
git push origin master

then your pages are deployed to GitHub

btw since the <master> changed to <main>, you can run

git push origin main

6. looking up the URL of your project

go to GitHub setting to see the URL, make sure the root is gh-pages

Done. The site is published now

👉Follow me for more useful web development content! love sharing🥰

--

--

YvonneDev
YvonneDev

Written by YvonneDev

❤️Front-end Web Development self-taught *share what I learned*

No responses yet