Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github pages still shows README after deploying React app

I have a create-react-app project (https://github.com/khpeek/beomaps/tree/master) which I'd like to deploy to Github pages using gh-pages. Following this tutorial, https://medium.com/@serverlessguru/deploy-reactjs-app-with-s3-static-hosting-f640cb49d7e6, I've added the following to my package.json:

enter image description here

However, if I run npm run deploy, it is published,

enter image description here

but the Github page, https://khpeek.github.io/beomaps/, still shows default content based on the README.md. Do I perhaps need to change the deploy directory?

like image 873
Kurt Peek Avatar asked May 31 '19 18:05

Kurt Peek


2 Answers

In the Options page of the repository, I had to select the gh-pages branch instead of the master branch:

enter image description here

(I also re-installed gh-pages as a normal dependency, not a development one (i.e. npm install gh-pages --save instead of npm install gh-pages --save-dev), though I'm not sure whether this was important).

Now the page is visible on Github pages:

enter image description here

like image 131
Kurt Peek Avatar answered Sep 21 '22 03:09

Kurt Peek


I think this has to do with github not knowing which branch it should use (master vs main or idk). Changing my deploy script as follows solved the issue for me:
"deploy": "gh-pages -b main -d build"
This tells github pages that it should use branch main.

like image 24
rpsteiger Avatar answered Sep 22 '22 03:09

rpsteiger