Programing

Github Pages에서 HTTP 404를 수정하는 방법?

lottogame 2020. 6. 28. 18:29
반응형

Github Pages에서 HTTP 404를 수정하는 방법?


gh-pages지사의 GitHub 저장소는 다음과 같습니다 . 모든 것이 좋아 보입니다 index.html. 내 CSS, JS 및 사진 폴더가 있습니다.

그러나 http://roine.github.com/p1에 액세스 하면 HTTP 404를 찾을 수 없습니다.

어떤 설명과 해결책?


나는 모든 파일을 단 하나만 커밋했다. 빈 커밋을 푸시하고 페이지를 새로 고쳤으며 작동했습니다.

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

필자의 경우 이름이 _(와 같은 _css_js)로 시작하는 폴더가 있었으며 GH 페이지는 Jekyll 처리 규칙에 따라 무시합니다. Jekyll을 사용하지 않는 경우 해결 방법은 .nojekyll루트 디렉토리에 이름이 지정된 파일을 배치하는 것 입니다.


나는 모든 트릭 않았다 여기내 포크 에 수정 페이지 404 Github에서 페이지 하지만 404'ing 유지했다.

Finaly는 내 브라우저 가 웹에 10 분 전에 캐시유지하지 않는다는 것을 발견했습니다 .

/index.htmlURL 끝에 추가 하면 표시되고 문제가 해결되었습니다.

https://username.github.io/index.html


4 개월 전에 저는 지원팀에 연락하여 문제가 있다고 말했고 일시적으로 문제를 해결했습니다 (현재 커밋에 대해).

오늘은 다시 시도

  1. github에서 gh-pages 분기를 삭제했습니다.

    git push origin --delete gh-pages

  2. 로컬에서 gh-pages 분기를 삭제했습니다.

    git branch -D gh-pages

  3. 나는 자식을 다시 초기화했다.

    git init

  4. 현지에서 지점을 다시 만들었습니다.

    git branch gh-pages

  5. gh-pages 브랜치를 github로 푸시했습니다.

    git push origin gh-pages

제대로 작동합니다. 마지막으로 페이지에서 파일을 업데이트 할 수 있습니다.


아직 GitHub 페이지 설정 탭에서 Jekyll 테마를 선택하지 않은 경우. 분명히 이것은 당신이 지킬를 사용하지 않는 경우에도 필요 페이지 사이트.

GitHub 설정 스크린 샷


gh-pages지점 과 레포를 포크 한 후에도 같은 문제가있었습니다 . index.html포크의 gh-pages브랜치 에 새로운 커밋 (공백 만 있음 )을 밀어서 고칠 수있었습니다 .


내 경우에는 2017 년 8 월 8 일

  1. 사용자 페이지가 https://github.com/mgravell 인 경우 리포지토리 이름은 mgravell.github.io 여야합니다 .
  2. 루트 아래에서 파일을 만듭니다 index.html

  3. 루트 아래에 폴더 docs를 만들고 CNAME아래 에 파일을 만듭니다 docs(참고 : .txt와 같은 확장자는 없습니다 . 파일 시스템에 확장자가 있는지 확인하십시오)

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

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


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


Just wait about ten minutes to one hour. If it still doesn't work, contact github. Usually it's the problem at their end. But, if you're in a hurry, you can try to open by adding "?" question mark at the end of URL. It force query to search for the resource. Like this:

http://roine.github.com/p1?


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!


Add the following in the beginning of the index.html file

<!DOCTYPE html>

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")


In my case, all the suggestions above were correct. I had most pages working except few that were returning 404 even though the markdown files are there and they seemed correct. Here is what fixed it for me on these pages:

  • On one page, there were a few special characters that are not part of UTF-8 and I think that's why GitHub pages was not able to render them. Updating/removing these char and pushing a new commit fixed it.
  • On another page, I found that there were apostrophes ' surrounding the title, I removed them and the page content started showing fine

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.


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.


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


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.


On a private repo, when I first added and pushed my gh-pages branch to github, the settings for github pages automatically changed to indicate that the gh-pages branch would be published, but there no green or blue bar with the github.io url and no custom domain options.

It wasn't until I switched the source to master and quickly switched the source back to gh-pages that it actually updated with the green bar that contains the published url.


Go to settings section of your repository and choose master branch at the Source section and click save button after that refresh the page and you will be able to see the link of your page!.


I faced this problem (404) too and the root cause was my file was named INDEX.md. I was developing on Windows and my local Jekyll site worked (since Windows treats file names case insensitive by default). When pushed to Github, it didn't work. Once I renamed the INDEX.md to index.md, things worked well.


Yet another scenario:

  • using an Organization Page (not a Project page) that has a repository named <orgname>.github.io
  • source documents as markup in master branch (asciidoc)
  • Travis CI pulling source doc files from master and pushing generated html files to gh-pages branch

The gh-pages branch is updated with the generated html pages. The GitHub Environment tab provides the link to the organization page. Clicking it results in a 404.

According to https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/

User and Organization Pages that have this type of repository name are only published from the master branch

If I understand this correctly, GitHub Pages will not be published from the gh-pages branch if you are creating a User or Organization site rather than a Project site.

I renamed my repo to make it a Project site rather than Organization site and then the gh-pages branch was published as expected.


I had same issue.. Very strange issue.. My HTML was with space after title

> <title>
> 
> <script>

Fixed, after removing space

> <title>
> <script>

Also, GitHub pages doesn't currently support Git LFS. As such, if you have images (or other binary assets) in GitHub pages committed with Git LFS, you'll get 404 not found for those files.

This will be quite common for documentation generated with Doxygen or similar tool.

The solution in this case is to simply not commit those files with Git LFS.


In my case my repository was private. Make repository public and go through all steps again.


Another variant of this error:

I set up my first Github page after a tutorial but gave the file readme.md a - from my perspective - more meaningful name: welcome.md.

That was a fatal mistake:

GitHub의 리포지토리를 탐색 할 때와 다르지 않은 index.md(또는 index.html) 가 없으면 README 파일을 사이트의 인덱스로 사용합니다 .

( GitHub 페이지를 사용한 게시에서 1, 2, 3만큼 쉬움 )

나는 다음 사용하여 내 웹 사이트의 페이지에 액세스 할 수 있었다 published at링크 에 지정된를 Repository/ Settings/ GitHub Pages다음 welcome.html이하 welcome.

참고 URL : https://stackoverflow.com/questions/11577147/how-to-fix-http-404-on-github-pages

반응형