xxxxxxxxxx
1) git init
2) git add -A
3) git commmit -m "first commit"
4) git remote add origin https://github.com/username/reponame.git
5) git push -u origin master
xxxxxxxxxx
In package.json add the following in this order:
"homepage": "https://{your-github-name}.github.io/{name-of-your-repo}"
in the Scripts section, add:
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
Save and commit Changes.
Push your changes to github.
Finally, in the terminal run:
npm run build
Your react app will be successfully deployed to github pages