Host React.js App for FREE in 5 mins with GitHub Pages

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ส.ค. 2024
  • In this short video, we will use the awesome GitHub Pages feature to deploy our React.js app for free. You can even add a custom domain later! This technique would also work for other static websites too. Hope you enjoy the video and find it useful!
    ----------------------------------------------------------
    ⌨️ Commands Used
    ----------------------------------------------------------
    Step 1
    ▶️ git remote add origin [YOUR REPO LINK]
    ▶️ git add -A
    ▶️ git commit -m "Initial commit"
    ▶️ git push -u origin main
    Step 2
    "homepage": "[USERNAME].github.io/[YOUR REPO NAME]",
    Step 3
    ▶️ npm install gh-pages --save-dev
    Step 4
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    ▶️ npm run deploy
    ----------------------------------------------------------
    ⏰ Timestamps
    ----------------------------------------------------------
    0:00 Introduction
    0:25 Step 1 (Get your React app on GitHub)
    2:11 Step 2 (Add final URL to package.json)
    3:33 Step 3 (Add gh-pages npm package)
    4:06 Step 4 (Create deploy scripts and deploy!)
    ----------------------------------------------------------
    📚 Resources
    ----------------------------------------------------------
    Editor (Visual Studio Code): code.visualstudio.com/
    Web Browser (Firefox Developer Edition): www.mozilla.org/en-GB/firefox...
    Terminal (iTerm, Mac only): iterm2.com/
    MDN (where I reference JavaScript documentation): developer.mozilla.org/en-US/d...
    ----------------------------------------------------------
    🔗 My Links
    ----------------------------------------------------------
    GitHub: github.com/jrgrimshaw/
    Instagram: / jrgrimshaw
    LinkedIn: / jrgrimshaw
    Personal site: jgrimshaw.com
    #jamesgrimshaw #react

ความคิดเห็น • 231

  • @SaroshAbdullah
    @SaroshAbdullah 3 ปีที่แล้ว +7

    You're awesome man! you explained everything in such a simple manner!

  • @pickitupgolf276
    @pickitupgolf276 2 ปีที่แล้ว +1

    Very helpful vid James!
    Appreciate the simplicity and easy to follow steps.

  • @ameybairolu3688
    @ameybairolu3688 2 ปีที่แล้ว +6

    Thanks a lot for this video lol. Crisp explanation and hence an absolute time saver. Couldnt ask for anything more! 😀

  • @RohanPaul-AI
    @RohanPaul-AI 2 ปีที่แล้ว

    This was tremendously helpful. Wish you all the growth in TH-cam.

  • @einnorw
    @einnorw 3 ปีที่แล้ว +16

    Every time I redo my portfolio website it's such a pain to get it deployed again. This video was so helpful. thank you so much!!!!

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว +1

      Glad you found it useful! 😄

  • @sanish_49
    @sanish_49 2 ปีที่แล้ว +1

    Thank you so much, deployed my app without any problem. That was smooth 😃

  • @tamimdewan1847
    @tamimdewan1847 2 ปีที่แล้ว

    This channel deserves a million subscribers

  • @ShravanKumar147
    @ShravanKumar147 2 ปีที่แล้ว +2

    Wonderful 5 mins
    Brilliantly explained

  • @romimaximus
    @romimaximus 2 ปีที่แล้ว

    Well ...perfect !! ..and straight to point !! Thank you very for sharing it !! 😁👍

  • @shourovfoisal
    @shourovfoisal 2 ปีที่แล้ว +3

    Excellent tutorial. Short and to the point! 💥💥

  • @JoshLearningFrontend
    @JoshLearningFrontend ปีที่แล้ว

    Don't Quit Your channel, Your content are fantastic❤, please create regular content🙏

  • @YannCedrick
    @YannCedrick 2 ปีที่แล้ว

    Thank you for the video. You deserve more subscribers

  • @27isagamer98
    @27isagamer98 ปีที่แล้ว +1

    Thanks a lot for this clear explanation. You saved my day!

  • @thevipinmishra
    @thevipinmishra 2 ปีที่แล้ว

    Very straightforward and easy to follow tutorial. 👍
    Just Subscribed.

  • @nidhishettigar6981
    @nidhishettigar6981 2 ปีที่แล้ว +1

    Thanks that worked for me. After many tries finally I hosted my react app.

  • @nkdsnk2128
    @nkdsnk2128 ปีที่แล้ว +1

    Didn't get it to work - probably something I did wrong. But I want to say that the video was spot on. No bullshit, just straight to the point and very clear. Subscribed!

  • @blackchristiangeek
    @blackchristiangeek 2 ปีที่แล้ว

    Awesome, thanks for the tips, you were answering questions that I didn't know how to ask 😅 Thanks again and God bless

  • @flux2956
    @flux2956 2 ปีที่แล้ว

    DUDE!!! I am a beginner and this stressed me out for days!! Glad I bump into your video!! The other ones are super hard to follow but yours is AWESOME!! I LOVE YOU MAN!!!(No homo)

  • @tobiastejeda4694
    @tobiastejeda4694 2 ปีที่แล้ว

    Excellent video helped me deploy my first react app ❤

  • @SarathChandran96
    @SarathChandran96 ปีที่แล้ว

    Superb presentation. quick and easy . very usefull

  • @sebastianelustondo
    @sebastianelustondo ปีที่แล้ว

    Thanks you James, you help me a lot with this github pages!!

  • @kirstengrimshaw563
    @kirstengrimshaw563 3 ปีที่แล้ว

    This is a fantastic video!!

  • @gabrielossamumaeda2091
    @gabrielossamumaeda2091 2 ปีที่แล้ว +2

    Nice video man!!
    If someone is running into the problem where the site displays some React Learn page or whatever, make sure you marked "gh-pages" on the page setup of GitHub pages settings.

    • @ernestosrf
      @ernestosrf ปีที่แล้ว

      Thank you so much! I was looking for a solution for this

  • @lgon9977
    @lgon9977 2 ปีที่แล้ว

    Man, you are amazing! Thanks a lot :)

  • @aietal.1596
    @aietal.1596 2 ปีที่แล้ว

    That helped a looot. Massive thanks.

  • @aris13pat1
    @aris13pat1 2 ปีที่แล้ว

    Nice tutorial. Thank you!

  • @user-qs8dk8bv2t
    @user-qs8dk8bv2t 2 ปีที่แล้ว

    תודה רבה 1000 פעם! תבורך מפי עליון!!!

  • @Msterken1
    @Msterken1 ปีที่แล้ว

    Good job, thank you for clean explanation and help.

  • @johnconnor9787
    @johnconnor9787 2 ปีที่แล้ว

    Thank you. That is what exactly I needed

  • @nathancwatkins
    @nathancwatkins 2 ปีที่แล้ว

    ty for the concise guide!

  • @TheLongAndNarrowPath
    @TheLongAndNarrowPath 2 ปีที่แล้ว

    Excellent DUDE!

  • @VishalPatel007
    @VishalPatel007 ปีที่แล้ว

    Awesome bro!! 💥💥

  • @roodyg5352
    @roodyg5352 10 หลายเดือนก่อน

    Thank you! This video was extremely helpful.

  • @rkscp7711
    @rkscp7711 3 หลายเดือนก่อน

    Your video is really helpful 🙌🙌

  • @delighteke9948
    @delighteke9948 5 หลายเดือนก่อน

    wow this video saved me from constant head ache, thanks bruv

  • @jakubkurdziel2407
    @jakubkurdziel2407 3 ปีที่แล้ว

    Great video, thanks!

  • @siruxsolutions
    @siruxsolutions 2 ปีที่แล้ว

    Great content!

  • @aviroxi
    @aviroxi 2 ปีที่แล้ว

    thank you so much :) you got new sub and new github follower ;)

  • @mohitnamdev3622
    @mohitnamdev3622 2 ปีที่แล้ว

    thanks a lot man, this was really helpful

  • @indranilnaskar2373
    @indranilnaskar2373 2 ปีที่แล้ว +1

    Awsome 🔥

  • @md.dilshadulislam9113
    @md.dilshadulislam9113 ปีที่แล้ว

    thanks a lot to put a sense of humor around it

  • @sahinurislam7247
    @sahinurislam7247 2 ปีที่แล้ว

    Thanks a lot sir, after watching more than 10 videos i got the right solution.

  • @CompoFriend
    @CompoFriend 2 ปีที่แล้ว

    Thanks for the excellent video it helped me & I deploy my first react app.

  • @yatut4467
    @yatut4467 2 ปีที่แล้ว

    Thanx for such useful content :)

  • @punitdixit861
    @punitdixit861 2 ปีที่แล้ว

    its really awesome....thanks James

  • @soumyadeepchatterjee2189
    @soumyadeepchatterjee2189 ปีที่แล้ว

    Thank you. If everything is fine please if possible upload some other project videos. You were great at making us understand.

  • @andrewkorsten2423
    @andrewkorsten2423 2 ปีที่แล้ว

    great video!

  • @andriikniaziev9242
    @andriikniaziev9242 ปีที่แล้ว

    Thanks man, it works!

  • @ts8960
    @ts8960 2 ปีที่แล้ว

    when I run npm run deploy , will it remove files from github too if I remove them in my project? or do I have to do everything manually

  • @thomasmeta2711
    @thomasmeta2711 2 ปีที่แล้ว +1

    Hey thanks for the video but I can't see the entirity of the website that I see locally on github pages. Do you know why?

  • @_.Mustafa._
    @_.Mustafa._ 2 ปีที่แล้ว

    ohh man !! Thanks a million. You saved my life.

  • @DeathProofXXX
    @DeathProofXXX ปีที่แล้ว

    Thanks for the video man

  • @ash__borne
    @ash__borne 2 ปีที่แล้ว

    Subscribed in less than 10 secs :)

  • @notyourtypicalteenager4651
    @notyourtypicalteenager4651 2 ปีที่แล้ว

    hey! when I upload my website it only shows some part of it, like for example I am deploying the whole thingbut when I click the link it only shows the navbar part and none of the links work on the navbar

  • @colouredpages
    @colouredpages 2 ปีที่แล้ว

    So nice you saved me!

  • @JulietteReacts
    @JulietteReacts 3 ปีที่แล้ว

    This was super helpful and I love your style of teaching (and it's always nice to hear another Northern accent) ...but I'm having an issue. My gh-pages is just displaying my README. :( I'm guessing that has to do with it not finding my homepage?

  • @enigma9445
    @enigma9445 2 ปีที่แล้ว

    Thank you bro, really help me 👏

  • @ratansen4542
    @ratansen4542 2 ปีที่แล้ว

    Hey! my react app is inside frontend folder of my repo.. What additional steps do i need to perform?

  • @dewann99
    @dewann99 10 หลายเดือนก่อน

    Thank you so much, I was really hoping that I don't run into issues the night before the big career fair day at my university, so I can show them my react-app portfolio.

  • @nfireOSX
    @nfireOSX 2 ปีที่แล้ว

    Thats very cool! My question: how to deploy an app with a database and link it? Can I do it in github pages or should I just rent a server with mysql installed or something?

  • @potato_tube
    @potato_tube 2 ปีที่แล้ว

    clear and neat

  • @dominiclapitan8466
    @dominiclapitan8466 2 ปีที่แล้ว

    You are insane. Thanks so much brooooo

  • @enjaee
    @enjaee 3 ปีที่แล้ว

    That helped Thank you :)

  • @minhazrabbi531
    @minhazrabbi531 2 ปีที่แล้ว

    Thanks a lot. ❤❤ I finally deployed my frist react app.

  • @naseehan5959
    @naseehan5959 ปีที่แล้ว

    your'e a life saver bro... thanks so much...

  • @OkatuLegends
    @OkatuLegends ปีที่แล้ว

    I love free content. Nice video love it

  • @adamspice9076
    @adamspice9076 ปีที่แล้ว

    great video

  • @damir-n1
    @damir-n1 2 ปีที่แล้ว

    Thank you!

  • @Tracer73866
    @Tracer73866 2 ปีที่แล้ว +4

    1:58 before pushing you need to create "main" branch by typing "git branch -M main". I received an error until i wrote that command

  • @Jake-zx9mp
    @Jake-zx9mp ปีที่แล้ว

    You're a hero

  • @brandongibson7050
    @brandongibson7050 2 ปีที่แล้ว +2

    I thought ctrl C was to copy? why would I copy the url then go to the cmd line and hit ctrl C again?

  • @nunez.rv3
    @nunez.rv3 2 ปีที่แล้ว

    Wooww you make it so simple

  • @Danebraaksma
    @Danebraaksma 2 ปีที่แล้ว

    Thank you! Great explanations and easy to understand.

  • @rohanism26
    @rohanism26 2 ปีที่แล้ว

    BEST VIDEO

  • @johanbjerkem8592
    @johanbjerkem8592 2 ปีที่แล้ว

    Thanks!

  • @yashaskirito
    @yashaskirito 2 ปีที่แล้ว

    I might be just missing something here but it's bugging me so I'll ask anyway.. when you are CLEARLY running the deploy script.. how is npm also running the predeploy script??

  • @Hemnath-nj8xg
    @Hemnath-nj8xg ปีที่แล้ว

    Thank you brother

  • @RickyHarerri
    @RickyHarerri 3 ปีที่แล้ว

    That was awesome !!!

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว

      I'm glad you think so! :)

    • @josephjose8292
      @josephjose8292 2 ปีที่แล้ว

      ​@@jamesgrimshaw it returns error page. any way thanks for this video

  • @tan5771
    @tan5771 2 ปีที่แล้ว +1

    Very easy tutorial..aaaaaa it helps me a lot to deploy my react project. I can go to sleep now 😂

  • @kenzafilali9115
    @kenzafilali9115 2 ปีที่แล้ว

    my application is pubished yet directly it displays my 404 pages configured by the route /* what to do ?

  • @sfafsashfdh6589
    @sfafsashfdh6589 2 ปีที่แล้ว

    How can I do this if I used some sort of API, and in JS file there is my private API key, shouldn't API key be private?

  • @diwashkafle7580
    @diwashkafle7580 2 ปีที่แล้ว

    thank you !!

  • @DevinDT99
    @DevinDT99 2 หลายเดือนก่อน

    For those using Vite, npm run build will by default use a "dist" folder rather than a build folder, so deploy won't recognize it. You can instead add the following to your package.json scripts!
    "predeploy": "npm run build",
    "build": "vite build",
    "deploy": "gh-pages -d dist"

  • @ashutoshnautiyal3372
    @ashutoshnautiyal3372 2 ปีที่แล้ว

    thanks a lot man

  • @adamdurrant
    @adamdurrant ปีที่แล้ว

    This didn't work for me. How does an app in a fresh repo get added to a separate gh pages repo? I already have a gh pages repo with stuff inside it.

  • @jonathanadel3831
    @jonathanadel3831 3 ปีที่แล้ว +1

    Thanks Bro, It Worked
    Can You Please Tell Us The Name Of Your VS Code Theme And The Folder Icons Theme Name?

  • @druashley
    @druashley 3 ปีที่แล้ว

    EZPZ thank you for this. Just deployed a soundboard on git

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว

      So happy to hear you found it useful!

  • @Lokoislive
    @Lokoislive 3 ปีที่แล้ว +1

    I have a problem with this. I did all the steps but I only get a blank screen, and when I inspect the console it tells me for the scripts enable javascript to run app, and I've done this several times and also for the website do I need to be in branch gh-pages or in master branch to make the website?? bc when I go masters i get the instructions file if I go to gh-pages branch I get the white page with enable js, nvm it worked idk how but at least it works so another question if I make some changes to my app all I need is to just do the same as before add the changes commit to it and then push it , but do I push it to my masters branch or gh-pages branch?

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว

      When you want to push changes, all you need to do is commit all your files like you did in the first step (except add origin, you only need to do that once), and then run “npm run deploy” as you did in the video. It is the exact same process, you don’t push to the gh-pages branch directly :) Hope this helps

    • @Lokoislive
      @Lokoislive 3 ปีที่แล้ว

      @@jamesgrimshaw ok that worked but when I modified some more now I'm getting the blank page again with saying enable js, when I first made a push it did change what I pushed but when I pushed some files and deployed it that when it went to the blank screen. here's my github if you want to see it github.com/pablovisual/pabloarmandosandoval

    • @Lokoislive
      @Lokoislive 3 ปีที่แล้ว

      nvm i found the problem, so with the route path I set to empty my website couldn't configure where the homepage was so it didn't show anything. but when i changed the route path to the actually path itself it was able to find it

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว

      @@Lokoislive great, glad to hear you figured it out. Just visited your website and it looks great!

    • @Lokoislive
      @Lokoislive 3 ปีที่แล้ว

      @@jamesgrimshaw thanks its still a working progress but ill get there

  • @hikyubestfriend6982
    @hikyubestfriend6982 2 ปีที่แล้ว

    thanks for tutorial

  • @marwantarekelmasry188
    @marwantarekelmasry188 9 หลายเดือนก่อน

    thanks man

  • @arminhirschfeld
    @arminhirschfeld 2 ปีที่แล้ว

    thank you very much

  • @mikkys5374
    @mikkys5374 ปีที่แล้ว

    how do you fix a "ENOENT: no such file or directory, stat" error?

  • @michaelc8876
    @michaelc8876 2 ปีที่แล้ว

    Thanks.

  • @pramilaniroshan572
    @pramilaniroshan572 3 ปีที่แล้ว

    Thank you

  • @mohamedtababi6537
    @mohamedtababi6537 2 ปีที่แล้ว

    thanks a lot

  • @ANKITKUMAR-ih3yk
    @ANKITKUMAR-ih3yk ปีที่แล้ว

    I have done all thing similar like in this video but still my site is live showing 404 error?

  • @manjicoder3049
    @manjicoder3049 2 ปีที่แล้ว

    How to commit in the gh-pages

  • @awesomedragon6367
    @awesomedragon6367 2 ปีที่แล้ว

    bro. how do you host react js frontend with backend. my backend login is not working. how do you do it??

  • @Swagmaster4000
    @Swagmaster4000 3 ปีที่แล้ว

    When I do this, it uploads my build folder to the github repo. Is there any way for it to also push the src and public folders/files? Basically I want to still upload everything, not just the build folder.

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว

      push your entire codebase to GitHub using the normal git commands, in addition to using the deploy commands

    • @Swagmaster4000
      @Swagmaster4000 3 ปีที่แล้ว

      @@jamesgrimshaw So on my page, I have two branches: one is the master branch with my entire codebase and one for the gh-pages. After force pushing my main codebase to github using normal commands, I then ran the deploy commands to see if anything changes, but my website instead now shows the readme page again. Am I supposed to do anything with the two branches?

    • @jamesgrimshaw
      @jamesgrimshaw  3 ปีที่แล้ว

      @@Swagmaster4000 the master branch is where your entire code base lives, that’s where you push to, and the gh-pages branch is for the hosted website, you don’t have to manage that branch. The predeploy script will create a build folder, and the deploy script sends that to the gh-pages branch which is where the hosted website gets its data from. Hope this makes sense :)

    • @Swagmaster4000
      @Swagmaster4000 3 ปีที่แล้ว

      @@jamesgrimshaw Makes a lot of sense. Another thing I learned is that sometimes you might need to go into github pages settings in the repo and toggle the right branch to make everything work out