Well this is very annoying, I am trying to deploy my first React app built with create-react-app, I googled about how to do this and it looks like I’m missing something, I am following the commands shown in the terminal, but nothing works. I go to youtube but everyone seems to be skipping a step.
Now I am not a git expert but at least I know how to deploy a static site on GitHub, how can I deploy this app?
Btw, why after I run npm run build and the build folder with all its files is created, then i run git status I don’t see any changes in the terminal?, it says the branch is up to date but what about this new folder that isn’t registered?
Hey @Gilbert1391. Do you specifically need to deploy the application to GitHub. I created a video detailing how I deployed my Random Quote Machine to Netlify. It’s pretty easy. Hope it helps.
Github itself isn’t deploying a site, per se. It is creating a public repo, so people can see your code. You can’t “run” the code. For that you need a hosting site. Github will do static hosting for you, through their github pages. I assumed that what you were trying to do was a CRA automated way of doing that. I just did it the manual way - creating the github pages repo and pushing my build bundle there.
I still say it would be better to simply learn how to do a CRA build and how github pages works. Eventually you are going to have to deploy an app somewhere else and you won’t have scripts to do it for you. And eventually you may want to push something besides a CRA to github pages and things are going to get complicated.
Really, learning how to create a repo for the github pages and pushing to it is simple. The only other thing you need to understand is the CRA build process, which is not that complicated and you need to understand anyway. Personally, I find these scripts more complicated than simply doing it.
Yes I will also try your method as well, in fact it does sound a easier actually, it seems like just deploying a site like the others static sites I have deployed in the past using GitHub. I mean by your comment I take it like that’s exactly what it is. Just get the build folder from CRA, create a repo and push the files to that repo, go to settings and select master branch, done. Your site is now live.
Last night I was just tired and eager to deploy my app, so I followed the first tutorial I found and got errors.
Basically, it just needs to have the specific name that github wants for its gihub pages. I think it has to be “[username].github.io”. I don’t think there are other requirements - check the github docs. I had to do it this way because I was hosting my portfolio app on github and that was written in jQuery but I had sample React apps in folders. I don’t know how the other method handles anything but a simple React app.