How to Deploy React App to GitHub Pages

Поделиться
HTML-код
  • Опубликовано: 7 фев 2025
  • ★☆★ My Courses: telmoacademy.com/
    ★☆★ 1-on-1 Mentorship: calendly.com/t...
    ★☆★ SkillShare 2 Months FREE : skl.sh/2Q2LsTi
    ★☆★ Best Website Hosting:
    partners.hostga...
    ★☆★UDEMY COURSES:
    *The Complete JavaScript Course 2018: bit.ly/2Ci2Fzk
    *Modern JavaScript From The Beginning: bit.ly/2Br13BM
    *JavaScript: Understanding the Weird Parts: bit.ly/2Epdgu2
    *React 16.6 - The Complete Guide (incl. React Router & Redux): bit.ly/2Br2ikq
    *The Complete React Web Developer Course (with Redux): bit.ly/2zXq9IH
    React Front To Back: bit.ly/2STDUPo
    ★☆★Best laptops for Coding:
    Acer Aspire: amzn.to/2FJrOVh
    Macbook Pro 2013: amzn.to/2NbYIUp
    Asus VivoBook Pro: amzn.to/2YgrCUG
    Macbook Pro 2019: amzn.to/2Xzi4qG
    ★☆★Best JavaScript Books
    John Duckett JavaScript: amzn.to/2EAEvkj
    JavaScript Easy Steps: amzn.to/2VRM4sN
    JavaScript Good Parts: amzn.to/2EFul1V
    Eloquent JavaScript: amzn.to/2Quq5qH
    You dont know JavaScript: amzn.to/2K9I9VX
    My Social Media:
    Twitter: / devtelmo
    Instagram: / sampaiotravels

Комментарии •

  • @diversecontent788
    @diversecontent788 4 года назад +195

    I thought learning react was difficult but then I found that publishing it is more difficult thank you man!

    • @owenmoogk
      @owenmoogk 3 года назад +9

      yeah lol learning react is easy compared to this

    • @oaaees
      @oaaees 3 года назад +1

      lmao 😂

    • @HafizRahmanBD
      @HafizRahmanBD 3 года назад +1

      😅😅

    • @poeticider
      @poeticider 2 года назад

      So true...!

    • @rbonnici
      @rbonnici 2 года назад +1

      I've been programming for 20 years, and it always becomes more complicated instead of simpler. Pity.

  • @jeffrey5718
    @jeffrey5718 3 года назад +5

    so to summarize it up:
    step 1: create your github repository
    step 2: initialize your local directory into a git repo using git init
    step 3: git remote add origin github.com/username/repo
    step 4: Add homepage in package.json file using "homepage": "myusername.github.io/my-app" make sure 'my-app' is named exactly the same as your git repo created in step 1.
    step 5: Install gh-pages using npm install --save gh-pages
    step 6: Add the following scripts in your package.json: "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    step 7: git add . and git com mit -m "whatever"
    step 8: npm run deploy
    step 9: git push origin master for pushing all the changes to git repo so you have a repo to reference to.
    Rigorously follow this order so that you don't fuck shit up. I messed up the order and ended up having heaps of errors, wasted a good 40 mins trying to solve it myself. Motherfucker!!!!

    • @Matin1999_T
      @Matin1999_T 3 года назад

      unfortunately i'm still getting the same errors.
      'sw-precache' is not recognized as an internal or external command,
      operable program or batch file.
      npm ERR! code ELIFECYCLE
      npm ERR! errno 1
      npm ERR! react-web-test-1@0.1.0 build: `react-scripts build && sw-precache --config=sw-precache-config.js`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the react-web-test-1@0.1.0 build script.
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
      npm ERR! A complete log of this run can be found in:
      npm ERR! C:\tmp
      odejs
      pm-cache\_logs\2021-12-30T20_41_32_006Z-debug.log
      npm ERR! code ELIFECYCLE
      npm ERR! errno 1
      npm ERR! react-web-test-1@0.1.0 predeploy: `npm run build`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the react-web-test-1@0.1.0 predeploy script.
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
      npm ERR! A complete log of this run can be found in:
      npm ERR! C:\tmp
      odejs
      pm-cache\_logs\2021-12-30T20_41_32_033Z-debug.log

  • @MfanufikileNicholsonGalela
    @MfanufikileNicholsonGalela 4 года назад +22

    Best tutorial... struggled whole night yesterday woke up this morning found and now my is deployed

    • @Telmosampaio
      @Telmosampaio  4 года назад +1

      I hope it helped you, make sure to press the like button :)

  • @winnizhang1224
    @winnizhang1224 2 года назад

    Thank you sir!!! Best video of explaining how to deploy react.js on github pages !!!!

  • @Scapben
    @Scapben 4 года назад +9

    For those that aren't that smart like me and new to github:
    Your original code is in the branch master
    Your uglified/optimized code is in the branch gh-pages
    So if you want to show your code for a job interview for example, make sure to link the master branch and not de default one that is gh-pages

    • @makanmusty
      @makanmusty 3 года назад +3

      Hey! How do you push changes from Master to Gh-pages branch?

    • @WowNemy
      @WowNemy 2 года назад

      @@makanmusty I have the same problem! Did you manage to make it work?

  • @patrickbrycesteen7388
    @patrickbrycesteen7388 4 года назад +4

    If anyone is having an issue and is seeing a blank white screen when your repo is uploaded double check that your branch is being built from gh-pages and that production build is deleted from your git-ignore file.
    # production
    /build
    This worked for me.

    • @luisantonioloustaunaubauti7312
      @luisantonioloustaunaubauti7312 4 года назад

      I also had a blank page and just redid all the steps. I had to remove the origin and do it again, and the second time it worked!

  • @itikasarkar4782
    @itikasarkar4782 3 года назад

    I've searched and seen a lot of videos for hosting react app but ended with errors. I was loosing hope but at that time your vdo saved me and helped me to get an internship. Thank you means a lot. :)

  • @zakariaben-harchache2275
    @zakariaben-harchache2275 4 года назад +7

    amazing video! was struggling all day and had to keep deleting and recreating repositories, this vid helped a ton! Thanks Telmo, means a lot!!

  • @ionutmarian1356
    @ionutmarian1356 2 года назад

    Dude you should onestly receive an award for this video, very very useful

  • @pearlstar1427
    @pearlstar1427 4 года назад +1

    Thank you very much!
    I was having trouble with it so I used "https" instead of "http". Then, it worked.

  • @ADogNamedMilo
    @ADogNamedMilo 3 года назад

    Thank you Telmo. I was struggling to get my react app delivered properly to github pages. This video helped me a through. Have a great time and be well.

  • @tasteofbengal7908
    @tasteofbengal7908 4 года назад

    Tried for two days and failure again and again. Then I found your video and my project is successfully deployed. Thank u man.

  • @shubhamcodes9030
    @shubhamcodes9030 2 года назад

    Thanks buddy,this was really helpful 🙌🏻,deployed my web app 😅in minutes

  • @joshypeepoo
    @joshypeepoo 2 года назад

    Dude, thank you so much! You are a lfesaver! I have been trying to do this for the past 3 hours and ran across your video.

  • @igor49134
    @igor49134 2 года назад

    Brother, this video has just made my life sooo easier. Feels like the most important video on YT rn :D Thank you so much! Liked, subscribed

  • @andrywinmaquinto5387
    @andrywinmaquinto5387 4 года назад +3

    Best tutorial. The start of my very first own portfolio. Thank you!

  • @sukantadinda9130
    @sukantadinda9130 4 года назад +1

    A bit thank you from my side. I have been stuck at this point for almost one night, finally, it is done.

  • @tiagogrimaldirossi7412
    @tiagogrimaldirossi7412 4 года назад +1

    Only guide that worked for me. You're a life savior.

  • @avkumar1764
    @avkumar1764 2 года назад

    Thank you bhaiya...i deployed my first project on github...thanku so much.

  • @shaneilkapadia4660
    @shaneilkapadia4660 4 года назад

    Best Tutorial for creating a react website using github pages!!! Thank you so much!

  • @SaeThunder
    @SaeThunder 3 года назад

    Enjoyed hearing the portuguese accent :)
    Followed the instructions and now have my github webpage. Thanks!

  • @adamm2716
    @adamm2716 4 года назад

    guide worked for me once i stopped trying to do everything beforehand and just followed along. then when you changed the app around i just brought in my src and just like that good to go. 10/10

  • @danielsladecek8258
    @danielsladecek8258 2 года назад

    Telmo, thank u for your video, i was so simple to understand!!! it is already in my bookmarks video on pc!!!

  • @ShyamSundar055
    @ShyamSundar055 4 года назад

    Thanks a lot...successfully deployed my first react app to github

  • @TacklessNebula3
    @TacklessNebula3 4 года назад

    Came across many, but this one took my heart!
    .
    .
    .
    .
    All I am saying is that it worked... thanks Telmo!

  • @pratikgohil7821
    @pratikgohil7821 4 года назад +2

    if you are using react-router on your app, then add this line to your router `( ) this will point to homepage that you add in your package.json file

  • @prasenpatil4201
    @prasenpatil4201 3 года назад

    This was the easiest step-by-step and systematic method i found... Thank-you very much brother

  • @princedanielsmart5787
    @princedanielsmart5787 Месяц назад

    Bro just saved my life u gained a subscriber

  • @Morangodone
    @Morangodone 4 года назад

    Thank you very much, sr! You helped me to put my first project online!
    I'm brazilian, but i understood everything you said. Nice pronunciation.
    thanks again!

  • @sahilimrosezahin4403
    @sahilimrosezahin4403 3 года назад

    thank you for sharing a free site to deploy react app. you are a helpful man.

  • @leopolis91-d2i
    @leopolis91-d2i 2 года назад

    Fantastic idea to write some parts of the text with a dark text on a dark background

  • @jainamchheda
    @jainamchheda 2 года назад

    THANKS ALOT! THE VIDEO REALLY HELPED ALOT AND I COULD SAVE A LOT OF TIME FOR MYSELF! NICE WORK! 🔥🔥🔥🔥🔥🔥🔥🔥

  • @ДмитрийЮсов-н4ъ
    @ДмитрийЮсов-н4ъ 4 года назад +4

    That is great man! Thank you so much! I tried to find something worthy in my native language, but your explanation was easyer even for my knowledge. Your tutorial pritty easy and cool!

    • @dim3143
      @dim3143 4 года назад +1

      На русском к сожалению, крайне мало актуальной информации по JS. Приходится переходить на английский)

    • @djpe4ka
      @djpe4ka 3 года назад +1

      @@dim3143 Всё так, пацаны

  • @tusharjaiswal9480
    @tusharjaiswal9480 4 года назад +2

    git : The term 'git' is not recognized as the name of a
    cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was
    included, verify that the path is correct and try again.
    At line:1 char:1
    + git init
    + ~~~
    + CategoryInfo : ObjectNotFound: (git:Strin
    g) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
    What to do?

    • @houllapk
      @houllapk 3 года назад

      same did you found out any solution

  • @youtubesubscriberguy5196
    @youtubesubscriberguy5196 4 года назад +4

    If u have a problem try
    "deploy":"gh-pages -b master -d build "
    Instead of the usual deploy script + thnx bro ❤

    • @tomasz3727
      @tomasz3727 3 года назад +1

      Thanks

    • @stevendna8956
      @stevendna8956 2 года назад +1

      Thanks a lot bro. This method worked actually. 🥺😭😭😭😭

  • @orewa9591
    @orewa9591 3 года назад

    Thank you so much,
    Btw, how to make changes to the deployed app ? Just change the code on local, and use npm run deploy again ? or should I use git add and commit first, and then git deploy ?

  • @kryoleks
    @kryoleks 3 года назад

    Thanks a lot. Keep it coming. Your content is easy for understanding!

  • @devricardonovais1294
    @devricardonovais1294 2 года назад

    Excellent Telmo. Thanks! I have one question: In case I prefer to start my project using a template, how would I deal with the first command? I´ll make my guess, you tell me if I´m right: "$ npm init react-app [projectName] --template [templateRoute]"

  • @harshalsurwase2185
    @harshalsurwase2185 2 года назад

    I thought it's simple as deploying static webpages on GitHub , but now its more that that. Thank you✌✌

  • @JD-hq1kn
    @JD-hq1kn 2 года назад

    Thanks man. This was something new for me... Great tutorial

  • @pood_49
    @pood_49 4 года назад +10

    Thanks for the tutorial! I have a question: How do I make updates if I want to add/delete a new file/folder?

    • @yashdev42
      @yashdev42 3 года назад

      if you know how to update your repo tell me

  • @alexcost6353
    @alexcost6353 4 года назад +1

    Thanks Telmo, love having your videos to look back on now that your not my instructor anymore! :(

  • @topeadebayo8863
    @topeadebayo8863 3 года назад

    got stuck from a udemy course then came here... thanks so much

  • @salahuddinhissam
    @salahuddinhissam 4 года назад +1

    thanks Telmo, since two days i have been straggling with this issue.

  • @lefty6258
    @lefty6258 4 года назад

    thanks Telmo. Finally know how to deploy

  • @HiddenInformation10
    @HiddenInformation10 4 года назад +3

    TE AMO, EL UNICO QUE ME FUNCIONÓ, 3 PUTOS DIAS MIRANDO TURORIALES Y TODOS ME DABA ERROR.

  • @marniencueva9881
    @marniencueva9881 3 года назад

    Thanks Telmo! Now I have my own personal webite.

  • @rahman5723
    @rahman5723 3 года назад

    Thank u sir for giving this class...its very helpful

  • @Sapphiamur
    @Sapphiamur 4 года назад +10

    Thank you!! This tutorial saved me :dd.

  • @Kayne1b
    @Kayne1b 4 года назад

    Just started learning React recently and this was very helpful. Thank you so much!

  • @fedorevseev8867
    @fedorevseev8867 2 года назад

    Thanks for the video, that was simple to deploy a project with your straightforward explanations)) thanks man!

  • @manasbansal7946
    @manasbansal7946 3 года назад +1

    best video on this topic!! thank you!

  • @dayanr.5950
    @dayanr.5950 5 лет назад +24

    life saver, thanks

  • @quaidbergo
    @quaidbergo 4 года назад

    Thank you, thank you, thank you!! This was almost a wasted evening until I found your video.

  • @manishshaw2393
    @manishshaw2393 3 года назад

    nice video ......will this way work if i am using making some api calls.. ...and please what are the pros and cons of this way over other ways ..thanks

  • @JohriAnkesh
    @JohriAnkesh 4 года назад +1

    I am getting below error. Please suggest.
    PS C:\Users\test\Desktop\UI Tool\my-app> git init
    git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + git init
    + ~~~
    + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  • @jadyrama
    @jadyrama 3 года назад

    Waw thanks man!!! A hero without a cap

  • @MeganRoberta89
    @MeganRoberta89 3 года назад

    It worked!!! You're a lifesaver, thank you SO MUCH!!!! :D

  • @АннаПотреба-я2щ
    @АннаПотреба-я2щ 4 года назад

    Много часов мучений с гитхаб - репозиторием, чтобы мне за пару минут показали, как это сделать?) спасибо тебе, добрый человек)

  • @mariyammajeed1754
    @mariyammajeed1754 2 года назад

    Hey after I make further changes to the code and website how can I push it again to the git and show on the hosted website

  • @kryoleks
    @kryoleks 3 года назад

    One question, you was pushing the project to the remote repository using: "git push -u origin master". What is "-u" mean?

  • @siddhantbhardwaj4268
    @siddhantbhardwaj4268 4 года назад

    Dude, you're awesome !!! Am an absolute fan of your work !! More power to you !!

  • @kristijonasjurksas7088
    @kristijonasjurksas7088 4 года назад

    Thanks for the detailed tutorial man. Hope this gets me the job...

  • @Lala-k4z
    @Lala-k4z 2 года назад

    You saved me. Thank you from Korea

  • @bernardus3289
    @bernardus3289 2 года назад

    I wanna cry. WHY IS THIS SO DIFFICULT. But thanks this helped me so much

  • @AldebaranCanacasco
    @AldebaranCanacasco 4 года назад

    Best tutorial, I tried others and I fucked up my projects, you are awesome man. Thanks. Subscribed

  • @beenyshsaeed4559
    @beenyshsaeed4559 3 года назад

    Thank you for the help. You are awesome. It had been quite a headache for some time, now you have helped me figure it out so easily. Thanks again.

  • @andrewsoseiagyemang3420
    @andrewsoseiagyemang3420 3 года назад

    I’ve been looking for this. Thank you

  • @saraa404
    @saraa404 4 года назад +1

    adding "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    after "start" worked for me.
    Also.. running npm run deploy after pushing the code worked for me

    • @bryansantamaria5412
      @bryansantamaria5412 4 года назад

      Switching places on "predeploy and "deploy" after the "start" worked for me as well. All though i did run deploy before pushing..

  • @harshikerfuffle
    @harshikerfuffle 4 года назад

    thank you @Telmo, this tutorial solved a lot of my deployment issues!

  • @ejsmagic8011
    @ejsmagic8011 4 года назад +6

    Thank you you just saved my computer from being thrown at a wall haha

  • @norahwinda6034
    @norahwinda6034 2 года назад

    This was of great help. Thank you so much

  • @solangebrugnatelli
    @solangebrugnatelli 2 года назад

    You are awesome. Thank you so much for sharing this information with us

  • @Migsfigs
    @Migsfigs Год назад

    I'm.a bit confused with where/when to push. When you run git push to origin master, is that different than just running "git push"? Do we not run the latter bc it will push changes locally and cause a headache when running the deploy script? Do we ever even have to push to origin master?

  • @ninomuring6653
    @ninomuring6653 4 года назад

    What a very helpful content. One thing tho, I want to ask why it shows Compare & pull request? Thanks!

  • @hv6411
    @hv6411 3 года назад

    Awesome explanation!!! Thank you😁

  • @maciejjarmula
    @maciejjarmula 4 года назад

    Thank you!
    Very well explained, I just managed to run an instance of app I needed to go online.

  • @alyssaderensy
    @alyssaderensy 8 месяцев назад

    Hello, I'm trying to make a portfolio using a template. Locally, I have my portfolio appearing, but when I try to transfer it to Github, I only see the readme, any help?

  • @alezibezerra
    @alezibezerra 2 года назад +1

    You're a livesaver. I has spent 2 hours on stackoverflow already and none of the posts halped me. I guess I'm too much of a newbie. Anyways, this worked perfectly. I just ran into a problem because "private:true" in my json file so git only showed a blank page but after i changed it to "private:false" it worked perfectly ;

    • @VijoPlays
      @VijoPlays 2 года назад

      Thanks, I was missing that part!

  • @pjguitar15
    @pjguitar15 4 года назад

    Thank you. I just got my first react app published on Github

  • @athena76308
    @athena76308 3 года назад

    thank you, you were the only one who explained well and helped 😊😊

  • @ngel6171
    @ngel6171 2 года назад

    Thank you Telmo! Great.. even for rookies..

  • @aadil4236
    @aadil4236 3 года назад

    I did exactly as you instructed, and it is published all went well but I can't see anything when I go to the URL
    Any suggestions might help me. Thank you.

  • @robertobaldizon8206
    @robertobaldizon8206 3 года назад

    I thought that deploying react app to git hub is more difficult. Thank you very much.

  • @udini1
    @udini1 4 года назад

    Straight forward explanation of how to setup your React app on GitHub - The only thing I found lacking is information about different options for uploading . But the video suits the title. Good job anyway . +1

  • @MarsTheProgrammer
    @MarsTheProgrammer 4 года назад

    Thanks bro! I'm currently using Netlify for my smaller portfolio projects, but it is giving me issues with .env files. This is much more simple! I'll be moving all my smaller React projects to github pages now.

  • @lifewithoutbigbrother355
    @lifewithoutbigbrother355 3 года назад

    Awesome video man. Was wondering how i can update my site if it has already been deployed.

  • @SuperStar-hh1ul
    @SuperStar-hh1ul 2 года назад

    For beginners, also run "npm run build" to create build folder before running "npm run deploy".

    • @mosalah5113
      @mosalah5113 2 года назад

      What if you did "npm run deploy" first and didn't do "npm run build" as he didn't say do that first? So I didn't.

  • @yasmin-e
    @yasmin-e 4 года назад

    Only tutorial that worked out for me! thank you.

  • @rishabhgawai278
    @rishabhgawai278 4 года назад

    Thanks bro ,it is just so nice of you

  • @Migsfigs
    @Migsfigs Год назад

    Is this not designed for an app that you want to keep updating? Like once you run build, then you have the build folder in you main branch. How do you make changes to your app with the build folder in your project??

  • @neurofanaticyt157
    @neurofanaticyt157 4 года назад

    does it work with some kind of backend too like a database?

  • @Kayne1b
    @Kayne1b 4 года назад +1

    This might be a dumb question, but if we want to edit the app after deploying to gh and update the github repo with the changes, do we just run 'npm run deploy' again?

    • @melissahuerta8315
      @melissahuerta8315 3 года назад

      did it work for you?

    • @Kayne1b
      @Kayne1b 3 года назад

      @@melissahuerta8315 Yeah doing that was fine.

  • @yanlinghuang7002
    @yanlinghuang7002 4 года назад

    Life Saver!!!!! The tutorial is so helpful!!! Thank you very much!!

  • @nathanx.675
    @nathanx.675 2 года назад

    Can you maybe do a video on how to update the page?

  • @andrewpham3933
    @andrewpham3933 3 года назад

    Thanks man worked flawlessly!

  • @EveryThingOnNow
    @EveryThingOnNow 4 года назад

    Please help me, im trying to deploy it remote but its loading just the navbar, not loading the body section?

  • @olinkirkland
    @olinkirkland 2 года назад

    Great video. Easiest explanation ever. Thank you!

  • @asadali1268
    @asadali1268 4 года назад

    awesome way of teaching .subscribed

  • @oneManDev
    @oneManDev 2 года назад

    It's 2022 and still works as intended.