Getting a 404 error on my page

I’ve looked for solutions however, I can’t seem to find anything that works for me. I’ve created the repository and double checked to make sure that an index.html file exists with the correct documentation, but when I open my page, I still get the 404 error (index.html file doesn’t seem to be working). Any help would be appreciated! Here’s the link to my repo: https://github.com/karenLee57/karenLee57.github.io-hangman

1 Like

I think it’s because your repo is called  karenLee57.github.io-hangman instead of  karenLee57.github.io.

Hi,

Since your main repository is already name.github.io, then the other repositories does not need that in the title. Instead, you only need what you want after the / in your web address. So if you want yourname.github.io/hangman, then the repository name has to be “hangman”. Looking at your account, you already created a repository with the name “hangman” with the same code as the repository you linked in this post. I also tried going to the url, and the reason it might not work is because in the “hangman” repository, most likely, you do not have github pages activated. To do this, you simply have to go to the “Settings” tab of your “hangman” repository, and find GitHub Pages. Then make the source to “master” or “gh-pages”, whichever one you used in karenLee7.github.io repository. Then it should work.

4 Likes

I have enabled github pages by making source as gh-pages. Still  I am getting 404 error. This github repository is a private repository.

Check if your master has multiple repositaries…

if multiple repositaries try username.github.io/repositary_name

Hello @karenlee57! It does look like @mpboom and @yangciou were on the right track. If your repository is karenLee57/karenLee57.github.io-hangman, then the URL for your page is https://karenLee57.github.io/karenLee57.github.io-hangman. That is a mouthful, so I would recommend if you want a project site for this page, to name the repository something shorter. Your URL for project sites will always be https://karenLee57.github.io/<repository name>.

We frequently see confusion around naming Pages repositories, because you can also have one user site on your account. For the user site, your URL would just be https://karenLee57.github.io. However, to activate your user site, you must name your repository in a very exact way. In this case your user site repository would have to be named karenLee57.github.io. See below for more information about these two options.

For all those coming to this topic later with a similar issue, below are some common situations where we see 404 Not Found errors.

Check for these common issues:

Publishing source and published URL

There are two kinds of GitHub Pages sites: user/organization sites, and project sites. In most ways the two are identical, but there are differences in how and where they are published.

Every GitHub account is entitled to a single user/organization site, located in a repository called <username>.github.io and accessible at https://<username>.github.io (unless a custom domain is configured). User/organization sites are automatically published from the master branch, and cannot be published from any other source.

Project sites, on the other hand, can be enabled on any repository, and are accessible at https://<username>.github.io/repository-name (again, unless a custom domain is configured). These sites can be published from the master branch, gh-pages branch, or the /docs folder on the master branch, but must be explicitly enabled by configuring a publishing source under your repository’s settings tab.

Solution: Verify the publishing source and published URL from your repository’s settings tab

Double check that you are using the correct URL by visiting your repository’s Settings, and scrolling down to the GitHub Pages section. You should see the URL where your site is published. Here, you can also verify that a publishing source is set, and that it matches your expectations.


No valid default landing page (beware case sensitivity)

GitHub Pages is designed to serve one of a specific set of files as a default landing page for your site. The preferred files to be served are index.html, index.md, and README.md, in that order. If none of these files exist, your website will show a 404 Not Found error, even if there are other HTML files in the repository.

Note that GitHub Pages is case-sensitive, so Index.html (with a capital I) will also fail to function as a default landing page. Most Windows and Mac systems aren’t case-sensitive, but most web servers are, including GitHub Pages. This means that while your personal computer might consider Index.html and index.html to refer to the same file, GitHub Pages won’t. Ensuring the use of entirely lowercase filenames is the best way to avoid these issues.

Solution: Create one of these files

Create a file named index.html, index.md, or README.md to act as your default document (home page). You can also rename an existing HTML or Markdown file to one of these 3 filenames.


Repository is a private repo on a free plan

GitHub Pages in private repositories is only available on the following plans: GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

Sometimes people switch their repository’s visibility to private. This will unpublish the Pages site, and switching back to public will not automatically re-publish.

Solution: Verify plan

Double check that your plan supports Pages in private repositories. If it does not, make sure the repository is public, and then push a commit to build the site again.


I just published, but am still getting a 404 error

It’s possible that you just published the project or published a new commit but aren’t seeing any new updates.

Solution: Allow a few minutes

It can take up to 10 minutes for GitHub Pages to build and publish your site. Allow some time for the build to complete, and also clear your browser’s cache.


Additional Resources:

If you are here looking for a solution to your 404 Not Found issue, I hope we’ve been able to help with the information above! Here are some additional resources that may be helpful:

About GitHub Pages:
https://help.github.com/en/github/working-with-github-pages/about-github-pages

Configuring a publishing source for your GitHub Pages site:
https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site

1 Like

hi,

i am getting an error while hosting my repository on git hub pages. i have followed all the steps properly while hosting on git hub pages but still the error is coming. I have used the initialized readme option.
please reply quickly