Deploy to Github Pages w/React + Google Domains

gus K
gus K
Nov 5 · 1 min read

So you made a react app and bought a domain now you want to deploy it!

Well its super easy…. you have to change settings in REACT -> GOOGLE -> GitHub

React

cd into your react app and plug this in

npm install gh-pages

in your package.json add the following (customize it for your webpage)

"homepage": "https://yourGOOGLEdomain.com",

under the Script key in your package. add the following pairs

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

then go back to your terminal and run

npm run deploy

Google

Go to the DNS settings and change the following settings

Custom resource records

@ type: A (make sure you hit the + to put them all in one)
185.199.108.153

185.199.109.153

185.199.110.153

185.199.111.153

www type: CNAME

yourusername.github.io

Github

Go to your github repo you wish to deploy. Go to settings and scroll down to the “GitHub Pages” options.

Select the branch “gh-pages”

In the custom domain enter your website …for example “mywebsite.com”. (no www.)

hit Save.

YOU ARE DONE

.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade