Github Pages site not detecting index.html

安稳与你 提交于 2019-12-20 09:46:13

问题


I created a github pages repository. For some reason when I give https://[username].github.io/, it doesn't work. But is works when I give https://[username].github.io/index.html. Whys is it not detecting index.html.


回答1:


It got fixed automatically. I just had to wait for a while for the settings to take effect.




回答2:


Pushing a second commit fixed this for me.

Seeing other answers where changes fix this, my guess is that you need to trigger a few of deployments to get it to work.

Every push will trigger a new deployment. You can track deployments at https://github.com/username/username.github.io/deployments.




回答3:


My index.html had the following DOCTYPE setting:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd">

Changing it to:

<!DOCTYPE html>

Fixed the issue for me.




回答4:


I had this exact same problem. If you try the link found in the designated repo > Settings > GitHub Pages after an hour after posting all your code, the GitHub page will work.




回答5:


This happened to me and as soon as I did another commit the issue resolved itself. I just added a space to the index.html file in my dist folder, committed and pushed that change to my gh-pages branch and BAM! Now I can access username.github.io/repository/index.html by just going to username.github.io/repository.




回答6:


If you don't use Jekyll, the workaround is to place a file named .nojekyll in the root directory.




回答7:


Pretty late to the party but here is how I fixed it for myself today.

  1. Go to settings for your repository: You can find Settings tab in your repo page.

  2. Scroll down to GitHub Pages section on the settings page.

  3. In the panel, you will have a Source info that states : 'Your GitHub Pages site is currently being built from the gh-pages branch'.

  4. However, in my cases, all code was in master branch. So I selected the branch from dropdown as master and in merely a minute, it was published successfully.




回答8:


Similar problem. I had to create random change to my html, go through the git add/commit/push process. That fixed it for me! Now I can access to my page without having to add .html at the end of the url.




回答9:


I had a similar problem for the private repository. My Git project contained index.html in root but the page did not display under http(s)://<username>.github.io/<projectname> path.

The solution for either way (public repository or not) is in enabling GitHub pages in project repository settings under 'GitHub pages'.

However, be aware that enabling pages under private repository make the .html files public.




回答10:


Faced this today (Oct-06-2019)

I double-checked every setting, all of them, didn't fix issue for me unless I changed some content in my index.html file. I also added some files to the repo to make it "alive" but in vain.

So, In my case, I opened up my index.html right in the browser, clicked on edit and added a single word, commit to master branch, refreshed and it took less than 5 seconds and it was up again.

P.S. I tried pretty much all solutions given anywhere nothing else worked for me.



来源:https://stackoverflow.com/questions/45362628/github-pages-site-not-detecting-index-html

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