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

旧街凉风 提交于 2020-07-05 10:00:49

问题


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?


回答1:


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/




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/43918286/github-pages-returns-readme-file-instead-of-index-html-cant-host-my-react-proj

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!