5

I have problem with host my react project on gh-pages. i Have my repo on github ----> GitHub repo My page return readme file instead of indx.html (public/index.html). ---> My Page

What should i do to my page with my react app works correctly?

Chris
  • 57,622
  • 19
  • 111
  • 137
Lukas
  • 229
  • 3
  • 4
  • 10
  • Related: http://stackoverflow.com/questions/25320356/can-i-have-my-github-pages-index-html-in-a-subfolder-of-the-repository – raina77ow May 11 '17 at 14:31
  • I'd suggest [this answer](http://stackoverflow.com/a/41773908/1229023) – raina77ow May 11 '17 at 14:31
  • I've answered this question for GitHub user pages here: https://stackoverflow.com/questions/47351598/why-is-my-create-react-app-showing-readme-md-not-index-html/47999475#47999475 – andrewwong97 Dec 27 '17 at 22:43

3 Answers3

9

In my experience, it was simply a latency issue. When I initially committed index.html (in the root of the repo), myorg.github.io continued to serve README.md. After a few hours, I returned and tried it again - lo and behold my index.html was served. Because of the time I was away, I can't make a guess about how long it takes github pages to update.

Jim Reesman
  • 224
  • 2
  • 6
  • 1
    Thanks for this answer! I was about to apply the change proposed by another answer, but now after waiting merely some 5 minutes, my README.md is server by `http://my_username.github.io/my_project`. – RayLuo Aug 10 '19 at 01:03
  • You can also try clearing the cookies, and then refresh the page. – Jay Ren Jul 09 '22 at 16:16
6

I have added front matter part to the readme.md and it fixed the problem.

---
permalink: /index.html
---

After this it shows index.html instead of readme. I have found this solution also helps for custom 404 pages. https://help.github.com/articles/creating-a-custom-404-page-for-your-github-pages-site/

Sergiy Kozachenko
  • 1,399
  • 11
  • 31
2

Yes, the problem is in how you have deployed your site, you should deploy your target index.html to gh-pages Check this out:

https://medium.freecodecamp.com/surge-vs-github-pages-deploying-a-create-react-app-project-c0ecbf317089

It gives a detailed and pretty good explanation on how to deploy react application to github pages.

slal
  • 2,657
  • 18
  • 29