Home > Software engineering >  How to update a website deployed on heroku?
How to update a website deployed on heroku?

Time:07-21

I created a website that I deployed on heroku. I have made some changes there and am looking to update my website to reflect these changes. To do this, I ran the following commands:

git status 
git init
git status
git remote -v

git add .
git commit -m"The file"
 git push heroku masterbranch

I want to clarify that the masterbranch branch is a branch that has been created. The base branch of my website is master not masterbranch. The reason why, I created a new branch is that when I ran the command: git push heroku master I was getting the error:error: failed to push some refs to 'https://git.heroku.com/gkwhelps.git' But I don't think that is the reason why my deployed site does not is not up to date.

CodePudding user response:

This has nothing to do with Git itself. See the heroku documentation, which notes that:

Heroku only deploys code that you push to the master or main branches of the remote. Pushing code to another branch of the heroku remote has no effect.

You mention:

when I ran the command: git push heroku master I was getting the error: error: failed to push some refs to 'https://git.heroku.com/gkwhelps.git'

When you push to the main or master branch, Heroku will:

  1. read your code;
  2. attempt to build your code based on what it read in step 1;
  3. attempt to deploy your build from step 3.

Any of these three steps can have errors. If they do have errors, Heroku uses Git to relay these errors to you and then tells Git to produce the above error message. So Git says that your push failed, but that's because Heroku told Git to fail it. You cannot fix this problem by creating another branch. You must address the problems that occurred in steps 1, 2, and/or 3.

CodePudding user response:

If you first push your code on Github and from Github do deploy, you shoud do:

git status
git add .
git commit -m 'changes'
git push

After that you should connect Heroku with Github and do deploy from that branch from Github.

  • Related