Skip to content

Github Pages 404s when redirecting to custom domain with React #23988

Answered by edmundweir
edmundweir asked this question in General
Discussion options

You must be logged in to vote

After much head scratching, I have solved the issue!

I’m a total noob at Git as a solo worker, but I believe the problem may have been that the deploy scripts in package.json are targetting the ‘gh-pages’ branch of my repo, which was basically empty (everything was in the master branch).

What I did to fix it: Repository Settings >> Github Pages >> Source: gh-pages (instead of master). Then, since I had built everything on the master branch of my repo (instead of gh-pages) I set my gh-pages branch to match my master with ‘git reset –-hard master’ in the terminal, followed by git push -f origin branch_name to force-push my gh-pages to upload to the origin and overwrite the random changes it…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant