How to fix page 404 on Github Page?

匿名 (未验证) 提交于 2019-12-03 02:16:02

问题:

https://github.com/roine/p1/tree/gh-pages here is a my github repository on the gh-pages branch. Everything looks good, I have my index.html, my css, js and pictures folders.

But when I access http://roine.github.com/p1 I have a 404 pages.

Any explanation and solution?

回答1:

Four months ago I have contacted the support and they told me it was a problem on their side, they have temporarily fix it (for the current commit).

Today I tried again

  1. I deleted the gh-pages branch on github

    git push origin --delete gh-pages

  2. I deleted the gh-pages branch on local

    git branch -D gh-pages

  3. I reinitialized git

    git init

  4. I recreated the branch on local

    git branch gh-pages

  5. I pushed the gh-pages branch to github

    git push origin gh-pages

Works fine, I can finally update my files on the page.



回答2:

In my case, I had folders whose names started with _ (like _css and _js), which GH Pages ignores as per Jekyll processing rules. If you don't use Jekyll, the workaround is to place a file named .nojekyll in the root directory.



回答3:

I had just one commit with all my files. I pushed an empty commit, refreshed the page and it worked.

git commit --allow-empty -m "Trigger rebuild" git push 


回答4:

I had the same issue after forking a repo with a gh-pages branch. I was able to fix by simply pushing a new commit (just whitespace in index.html) to my fork's gh-pages branch.



回答5:

My pages also kept 404'ing. Contacted support, and they pointed out that the url is case sensitive; solved my issue.



回答6:

In my case on 8/Aug/2017

  1. if your user page is https://github.com/abc, you repo name must be abc.github.io
  2. under root, create a index.html file

  3. under root, create a folder docs, inside docs, create a file CNAME (note: NO extension like .txt, make sure your file system shows extension)

  4. gh-pages branch is optional, master branch is enough

more: check official docs here: https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/



回答7:

I got the site to work by deleting the "username.github.io" folder on my computer going through the steps again, including changing the index/html file.

My mistake (I think) is that i initially cloned "https://github.com/username/username.github.io.git" instead of https://github.com/username/username.github.io (no ".git")



回答8:

If you saw 404 even everything looks right, try switching https/http.

The original question has the url wrong, usually you can check repo settings and found the correct url for generated site.

However I have everything set up correctly, and the setting page said it's published, then I still saw 404.

Thanks for the comment of @Rohit Suthar (though that comment was to use https), I changed the url to http and it worked, then https worked too.



回答9:

I bound my domain before this problem appeared. I committed and pushed the branch gh-pages and it solved my problem. New commits force jekyll to rebuild your pages.



回答10:

In my case, the URL was quite long. So, I guess there is a limit. I put it to my custom subdomain and it worked.



回答11:

in my case i had to go to project settings and enable the github pages. The default is off



回答12:

If you are sure that your structure is correct, just push an empty commit or update the index.html file with some space, it works!



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