Publish React App From create-react-app to Github

Free hosting for your react application easily with github

Publish your React.js application made with create-react-app to github easily with these commands.

⌨️ Commands Used

Step 0 (Create Repository in Github)

Create a Repository in github and collect the github repository remote url

Step 1 (Push The Repo To Github)

Put your repository link here

git remote add origin YOUR_REPO_LINK
git add -A
git commit -m "Initial commit"
git push -u origin main

Step 2 (Add Home Page for the app)

Replace jashezan with your github username. Also provide the repository link of your react app on github.

"homepage": "https://jashezan.github.io/[YOUR REPO NAME]",

Step 3 (Install gh-pages as Dev Dependency)

npm install gh-pages --save-dev

Step 4 (Deploy the React.js App with scripts)

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

Source video: https://www.youtube.com/watch?v=2hM5viLMJpA