I can’t update a Ruby project on Heroku with Git

Asked

Viewed 525 times

0

While trying to commit a few changes I made to my Ruby project and go up to Heroku, I got an error message.

Inside the project folder in the terminal I executed the commands:

$ git status
$ git add .
$ git commit -m 'msg'
$ git push heroku master

The following error has been returned:

! [Rejected] master -> master (fetch first) error: failed to push some refs to 'https://git.heroku.com/still-coast-1656.git' tip: Updates Were Rejected because the remote contains work that you do tip: not have locally. This is usually caused by Another Repository pushing: to the same ref. You may want to first Integrate the remote changes tip: (e.g., 'git pull ...') before pushing Again. Tip: See the 'Note about fast-forwards' in 'git push --help' for Details.

I tried to start a new repository to upload again;

$ git init
$ git add .
$ git commit -m 'msg'

New error has been reported:

In the master branch nothing to submit, empty working directory

How do I upgrade/upgrade my project in Heroku?

Thank you.

1 answer

5


The first error indicates that your project is outdated from what is in Heroku. You have two options. The first is:

git pull --rebase heroku master

And in this case you resolve the rebase to align the branchs. Once this is done, you can push normally.

The second option is the easiest:

git push -f heroku master

The -f means force. In this case you are saying "Heroku, the branch is mine, do as I say and ready". It will simply ignore any conflict, and will adopt its branch as the most current.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.