How to Deploy React App to GitHub Pages

Telmo Sampaio · 194K views · 2019 · 13:25

Open on YouTube

Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the walkthrough they followed when their React app failed to deploy to GitHub Pages, usually while asking about errors like 404s, blank pages, or failing npm run deploy.

Recommended by 1 people across 1 different months, 2020 to 2021.

What it is

A 13-minute tutorial by Telmo Sampaio showing how to deploy a create-react-app project to GitHub Pages. It walks through installing the gh-pages package, setting the homepage field and deploy scripts in package.json, and pushing the build to a gh-pages branch.

What people said

Recommends killerpizza · 2021-04 · Stack Overflow · on “npm run deploy failure when deploying React app to Github”

Problem: I am still very new to React and am trying to push my React app onto Github, but I keep running into an error when I deploy it on my console. Set Up: I am using Atom on a Windows 10 computer. I created my React app by using the commands, npx create-react-app jordon . I then followed the steps in this youtube tutorial [this video] . This is what my package.json looks like after following the tutorial: [LINK] I then went through the steps to initialize a github repository. However, after running npm run deploy , I come across an error: [LINK] I have tried to rerun the steps in the tutorial time after time, but either receive the same error, or an error that is resolved by uninstalling gh-p

Cites Simin Maleki · 2020-05 · Stack Overflow · on “error when deploying react app to github pages: fatal: could not read Username for 'https://github.com': No error”

This is my first time deploying an app to GitHub pages. I have an app in react which I want to host it in GitHub pages. I followed different tutorials (linked below) which almost introduce the same approach. everything is OK but at the end when I run npm run deploy , I receive this error : . I'm somehow new to GitHub and haven't set any config related to SSH key. Is it related? or any idea what the problem is? [LINK] tutorial I [this video] tutorial II [LINK] I tried to solve this issue by SSH. However, I get this error on "npm run deploy" and I'm stuck [LINK]

Cites Connor Twele · 2020-08 · Stack Overflow · on “React app errors when pushing to GitHub pages”

When pushing my React app to GitHub Pages, I continue to get various error messages. Some projects when viewed through GitHub just have a blank screen, others have 404 page not found errors, others bring up a page telling me that "this project was bootstrapped with create react app." I have tried using several different tutorials to deploy the projects in different ways. this one [LINK] this video [this video] The one and only project I got to work I used "deploy": "gh pages -b master -d build" . I have been installing gh pages using npm install gh-pages --save-dev on my projects. This is an example of the error I get in my terminal: sh: gh: command not found npm ERR! code ELIFECYCLE npm ERR! sys

Cites ssi-anik · 2020-10 · Stack Overflow · on “How to fix HTTP 404 on Github Pages?”

I was following this YT video [this video] . So, when I ran the command in my terminal, it pushed the code to gh-pages branch already. Then I pushed to the master branch. It was giving me 404 error. Then I swapped the branch to master and then again reverted to gh-pages and now the error is gone. It's pointing to the index.html even if it's not in the URL.