You upload the contents of the build folder to another branch, then in repository settings enable GitHub pages for that branch Answer from WallstreetChump on reddit.com
🌐
GitHub
github.com › gitname › react-gh-pages
GitHub - gitname/react-gh-pages: Deploying a React App (created using create-react-app) to GitHub Pages · GitHub
To create the React app, I'll be ... the React app, I'll be using gh-pages, which is an npm package people can use to deploy things to GitHub Pages, a free web hosting service provided by GitHub....
Starred by 7K users
Forked by 970 users
Languages   TypeScript 43.0% | HTML 37.0% | CSS 20.0%
🌐
Create React App
create-react-app.dev › docs › deployment
Deployment | Create React App
This is because when there is a fresh page load for a url like http://user.github.io/todomvc/todos/42, where /todos/42 is a frontend route, the GitHub Pages server returns 404 because it knows nothing of /todos/42.
Discussions

How would I deploy a static front end react app on GitHub pages?
You upload the contents of the build folder to another branch, then in repository settings enable GitHub pages for that branch More on reddit.com
🌐 r/react
9
1
November 26, 2024
reactjs - How can I host my React application using GitHub? - Stack Overflow
With this Github will create a new branch called gh-pages, and will be available online. Hope I could help and will work accordingly. If you stuck, you can look it up on the official docs of React. More on stackoverflow.com
🌐 stackoverflow.com
Deploying react to github pages
If possible could you please check Vercel? Much easier that way. More on reddit.com
🌐 r/react
24
4
July 26, 2023
Blank Page after deployment
After, i git clone my repository ... blank page. I tried everything and read the previous issues but could not find the solution. The website works in local. Which of these applies to you? (Select all that apply) I'm following the tutorial as-written from start to finish in link https://github.com/gitname/react-gh-... More on github.com
🌐 github.com
17
August 23, 2023
🌐
GitHub
github.com › facebook › react
GitHub - facebook/react: The library for web and native user interfaces. · GitHub
You can find the React documentation on the website. Check out the Getting Started page for a quick overview.
Starred by 244K users
Forked by 50.9K users
Languages   JavaScript 68.1% | TypeScript 29.0% | HTML 1.5% | CSS 1.1%
🌐
DEV Community
dev.to › kathryngrayson › deploying-your-cra-react-app-on-github-pages-2614
Deploying Your CRA React App on Github Pages - DEV Community
July 25, 2022 - Github Pages allows you to host a project directly from your Github account, quickly and easily. Since I already had my repo set up on Github, I was halfway there…but, as I discovered, there were a few things I needed to tweak in my React ...
🌐
LogRocket
blog.logrocket.com › home › how to deploy react apps to github pages
How to deploy React apps to GitHub Pages - LogRocket Blog
April 22, 2025 - Walk through deploying a Create React App project to GitHub Pages, customizing your domain, and automating deployments with GitHub Actions.
Find elsewhere
Top answer
1 of 3
11

You need to install GitHub Pages package as a dev-dependency.

cd ./into/your-app-folder
npm install gh-pages --save-dev

Add properties to package.json file.

The first property you need to add at the top level homepage, second you must define this as a string and the value will be "https://{your-username}.github.io/{repo-name}" , {repo-name} is the name of the GitHub repository you created it will look like this :

"homepage": "http://joedoe.github.io/your-app"

Second in the existing scripts property you need to add predeploy and deploy.

"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}

If you pushed everything already to Github, the last step is deploying. One liner:

npm run deploy

With this Github will create a new branch called gh-pages, and will be available online. Hope I could help and will work accordingly.

If you stuck, you can look it up on the official docs of React. Deployment Documentation of React

Once on a deployment I had some issues with the official documentation, and I had to delete my username from the "homepage" property in order to make it work. Although I suggest you first do by the docs, and if you encounter problems, you might can give a try.

2 of 3
1

You have to do the following things:

  1. Push your project to GitHub

    git add .
    git commit -m "Your message"
    git push
    
  2. To create a page on GitHub, you should:

    1. Add this to your package.json: "homepage": "https://myusername.github.io/my-app",

    2. npm install --save gh-pages

    3. Add the following scripts in your package.json

      "scripts": {
        "predeploy": "npm run build",
        "deploy": "gh-pages -d build",
        "start": "react-scripts start",
        "build": "react-scripts build",
      }
      
  3. Run npm run deploy

Now you'll have a new branch and your page in GitHub will be creating from this new branch.

🌐
Medium
medium.com › @amh03160 › deploying-a-react-app-on-github-pages-with-a-custom-url-fee94f3be82c
Deploying a React App on Github Pages With a Custom URL | by Allison Hill | Medium
April 22, 2022 - One of these options ended up being right under my nose the whole time- Github Pages! All you need to do is have a github repository for the project, tell github which branch to publish from, and voila! 95% of the work is already done for you!
🌐
ITNEXT
itnext.io › so-you-want-to-host-your-single-age-react-app-on-github-pages-a826ab01e48
So you want to host your Single Page React App on GitHub Pages? | by Brendan McIlhenny | ITNEXT
April 28, 2018 - GitHub has this feature called GitHub Pages that converts a GitHub repository into a living, breathing website with a click of the button… as long as this repo is a) written in Frontend code only(Javascript, CSS and HTML) and apparently b) ...
🌐
Reddit
reddit.com › r/react › deploying react to github pages
r/react on Reddit: Deploying react to github pages
July 26, 2023 -

I have to deploy my React app to github pages. I use React and Coveo Headless library. All my project files are tsx instead of js or jsx. I configured package.json to deploy it on github pages, but it deploys index.html template and loads blank page. Does anyone have idea how to resolve it?

As I am newby for this, I followed this tutorial for deployment, but no success.

https://youtu.be/Q9n2mLqXFpU

🌐
Pluralsight
pluralsight.com › blog › guides
Deploying React on Github Pages | Online Courses, Learning Paths, and Certifications - Pluralsight
July 10, 2020 - To do that, install the github pages package by running the following in your terminal. ... In your package.json file, add a deploy script to your scripts section. It should look like this so far. "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", #new "deploy": "gh-pages -b master -d build", "eject": "react-scripts eject" },
🌐
Medium
medium.com › @umarsunny2011 › deploy-react-app-on-github-pages-785226a20502
Deploy React App on Github Pages. After you made your React App in VS… | by UmarSunny | Medium
February 23, 2024 - 4. Go to package.json file in your ... place of YOUR_USER_NAME give your github username. ... 7. In your github repo Go to: Settings -> Pages....
🌐
GitHub
github.com › marketplace › actions › deploy-react-to-github-pages
Deploy React to GitHub Pages - GitHub Marketplace
This action uses the new GitHub Actions publishing method which allows you to create an artifact that contains the result of the build and serves the files in the artifact on the Pages site. There’s no need to check files back into your repository, keeping it nice and clean. This action deploys React/Javascript to Github Pages.
🌐
Nira
nira.com › home › how to deploy a react app to github pages
How to Deploy a React App to GitHub Pages
June 24, 2022 - Just know that you can’t push a private repository to GitHub Pages. So if you mark it private now, you’ll definitely need to go back and change this after. Make sure you select the option to initialize this repository with a README: Now you can create the new repository. If you haven’t done so already, you need to create a react app.
🌐
DhiWise
dhiwise.com › post › simplify-deployment-how-to-deploy-react-app-to-github-page
How to Deploy React App to Github Pages: A Comprehensive Guide
September 5, 2024 - React, a powerful JavaScript library for building user interfaces has become a go-to choice for developers creating dynamic and responsive web applications. With GitHub Pages, a hosting service that turns your GitHub repository into a website, you ...
🌐
GitHub
github.com › orgs › community › discussions › 64758
Deploying React App on GitHub Pages - "Page Not Found" Issue · community · Discussion #64758
Make sure you've given enough time for the GitHub Pages to build and deploy your app after pushing the changes. Check Routing Configuration: If your React app uses client-side routing (e.g., React Router), the routes might not work as expected on GitHub Pages due to its server configuration.
🌐
GitHub
github.com › gitname › react-gh-pages › issues › 159
Blank Page after deployment · Issue #159 · gitname/react-gh-pages
August 23, 2023 - GitHub Pages site (deployed app): https://cap-oglu.github.io/PortfolioWebsite/
Author   cap-oglu
🌐
GitHub
docs.github.com › en › pages › getting-started-with-github-pages › configuring-a-publishing-source-for-your-github-pages-site
Configuring a publishing source for your GitHub Pages site - GitHub Docs
Your GitHub Pages site will always be deployed with a GitHub Actions workflow run, even if you've configured your GitHub Pages site to be built using a different CI tool. Most external CI workflows "deploy" to GitHub Pages by committing the build output to the gh-pages branch of the repository, and typically include a .nojekyll file.