Lukas
Lukas

Reputation: 245

Github pages returns readme file instead of index.html. Can't host my react project

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?

Upvotes: 5

Views: 18521

Answers (3)

Jim Reesman
Jim Reesman

Reputation: 334

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.

Upvotes: 10

Serhii Kozachenko
Serhii Kozachenko

Reputation: 1401

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/

Upvotes: 6

slal
slal

Reputation: 2867

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.

Upvotes: 2

Related Questions