DEV Community

Cover image for Looking for an easy way to deploy your Dev build React project?
Sedrick Tha Dev
Sedrick Tha Dev

Posted on

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

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! 👨‍💻

Top comments (0)