Github website published

Why is only the readme file being published to github pages?

The repo: https://github.com/HaithamCa/Note-Keeper

Github page link: https://haithamca.github.io/Note-Keeper/

As far as I know, GitHub Pages looks specifically for an index.html file in the root directory of the project. If it cannot find one, it will not deploy the page correctly.

How to add the index.html to the root?.

Currently it’s in the public folder. The root directory is the base folder (where your README.md is). I would try moving the index.html file there - you’ll need to update your imports (like the CSS and JS links) though.

I followed these steps https://docs.github.com/en/github/managing-files-in-a-repository/moving-a-file-to-a-new-location
but unfortunately still the same result

Why have you named the file ..index.html?

Sorry, That is my bad.
I fixed it but now it’s not working at all although I changed the path in index.html to the index.js but now not working at all.

Also, I am tried to deploy it into netlify but the result is Site deploy failed.

You are still are having issues with your references being incorrect. On line 13 of your index.html your path is incorrect.

I changed it but still not working src="./src/index.js"

Oh, wait, this is a React app?

That takes a bit of a different process for deploying to GitHub pages, as React files need to be built/processed into standard JS.

I can not find built/processed. sorry I am new in react that why I am asking questions like this.

I think they are hosting directly on GitHub pages.

I’m also not seeing a package.json in your repository, @HaithamCa… What I am seeing is the readme says “Created with CodeSandbox”. I haven’t used CodeSandbox, myself, but I would be willing to guess that it works a lot like CodePen and handles a bunch of configuration for you in the background.

Did you copy your code files directly from CodeSandbox into your repository? If so, there are some essential pieces you are missing for deploying this to GitHub pages. @camperextraordinaire mentioned Netlify as a hosting option - this is very much a viable choice, though I believe you’d still be missing some steps (like the package.json to tell Netlify what to run on the build step?).

2 Likes

Here is the Error https://app.netlify.com/sites/clever-kirch-9f4788/deploys/5f637f46262798260b2a0c7a

Hi @HaithamCa, from my experience deploying to netlify, if react emits warnings, the build will fail because netlify interprets them as errors . Instead of npm run build, try
CI='' npm run build. You can also read through this question which is on similar issue.