404 Error when trying to publish w/ GitHub!

I’m trying to host a page on GitHub pages, but I seem to be having some errors with it. From what I understand, everything is where it should be, but I keep getting a 404 error when I try and access the page.

Link to the repo: https://github.com/Karan-Ghatt/My-Portfolio

It should be active at: https://karan-ghatt.github.io/My-Portfolio/

I would really appreciate if you could have a look and see if you can tell what’s going on. Much love people!

[EDIT]
I managed to get it loading! I had saved my file as Index.html, where it should have been index.html. All sorted on that front now! But I cant seem to get all the images to load! It manages to find the about image but nothing else, even though their in the same directory in the repo??

Hi @Karan-Ghatt, I just tried the link that you provided and your site loads for me. Are you still having issues loading it yourself?

I managed to get it loading! I had saved my file as Index.html, where it should have been index.html. All sorted on that front now! But I cant seem to get all the images to load! It manages to find the about image but nothing else, even though their in the same directory in the repo??

Do you have an example of an image link that is breaking? I don’t see any broken images.

Take a look at the difference in how you write the src value. This one works:

This one doesn’t:

The reason for this is that the second one, /images/passwordvault.png, means the same thing as https://karan-ghatt.github.io/images/passwordvault.png. Whereas, if you wrote it as ./images/passwordvault.png or images/passwordvault.png it would be the same thing as writing https://karan-ghatt.github.io/My-Portfolio/images/passwordvault.png, which would work.

You can learn more about how URLs and hyperlinks work in web pages on the Mozilla Developer Network documentation.

2 Likes