DEV Community

loading...
Cover image for Looking for an easy way to deploy your Dev build React project?

Looking for an easy way to deploy your Dev build React project?

Sedrick Tacool
Full-Stack React Developer. Master of MERN Stack. I JUST KNOW HOW TO GET THINGS DONE!!!FC-BARCELONA โšฝ | TEAM MERCEDES ๐Ÿš— | FIFA ๐ŸŽฎ | FULL-STACK DEV ๐Ÿ˜Ž
ใƒป1 min read

Assuming you already have an account on Github and Heroku

  1. Create a new repository on github,
  2. Open your terminal and navigate to your React project,

3. The below commands will initialize your project with github and link it to the repository you created in step 1.

FOR THE FIRST PUSH ONLY
git init
git add .
git commit -m "my first commit message, can be any message"
git remote add origin https://github.com/repositoryName.git
git remote set-url origin https://github.com/yourGithubUserName/repositoryName.git
git push origin master
git push --set-upstream origin master

FOR THE SECOND PUSH ONWARDS, YOU WILL NOW USE:
git add .
git commit -m "changes made in the files being committed"

git push

  1. On Heroku, create a new app and give it a name of your choice (NB: name will be used to create a subdomain for your app)
  2. Connect the Heroku App with your Github repo created in step 1.
  3. Allow auto deploy so that whenever you do a git push, those changes will now reflect on Heroku as well.
  4. After build is success, use the url given or simply visit YourHerokuAppName.herokuapp.com

Remember, you will only be using the below 3 commands onwards after this:
git add .
git commit -m "changes made in the files being committed"
git push

HAPPY CODING! ๐Ÿ‘จโ€๐Ÿ’ป

Discussion (0)