Reputation: 69
This is a react js app.I want index.html (which is in public folder by default) as my root folder or any link to navigate index.html here is my github page :-https://impratikprtk.github.io/almostthere/ and this is my repository :- https://github.com/impratikprtk/almostthere
Upvotes: 0
Views: 6431
Reputation: 1054
In my case, I had to make the active branch to be the gh-pages branch, and also from the settings' options tab make the Source branch to also be gh-pages branch.
Upvotes: 1
Reputation: 1
I had the same problem.
this should work!
Upvotes: 0
Reputation: 6572
I found this answer here to be much more helpful: GitHub pages only showing ReadMe file? . My site was showing the readme file because I had my source as master, and when I thought I was deploying for master, I was actually deploying to my remote with the gh-pages
branch which turned out to be much cleaner anyways. When it was reading from master, it didn't see an index so it showed the README.md
file by default.
I was deploying from a create react app. I didn't realize that running gh-pages -d build
actually created the gh-pages
branch on your remote (GitHub) and pushed to it exactly as needed automatically. That said, all I had to do to fix this problem was to change my source for pages to be the gh-pages
branch.
Set your source on the GitHub repository. I.e.
Your GitHub Pages site is currently being built from the gh-pages branch.
Add to your scripts in package.json
the deploy
and predeploy
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "yarn build", // <--- this and
"deploy": "gh-pages -d build" // <--- that
},
Deploy your app. yarn deploy
assuming you made the script as above.
Log into GitHub, go to your repository, and check out the gh-pages
branch that should have been created for you. It takes a couple minutes to update on the actual website, so this is a good first place to check to see that the deployment is working.
Note.. The documentations mention an initial deploy.. but I can see when I run
yarn deploy
that it actually runs yarn build
without me doing it first.. so I don't seem to need to run the "predeploy". Would love a comment here about that.
Upvotes: 0
Reputation: 957
Hope it works !!
Upvotes: 0