Zhen
Zhen

Reputation: 12431

Getting error when trying to git push to remote branch (Heroku)

Hi I tried to push my local changes to heroku production but I am getting the following error

Zhens-MacBook-Pro:Dailymuses-Server-Side zaikshev88$ git push heroku-production master:master
To [email protected]:dailymuses.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:dailymuses.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

The issue here is that when I tried to do a git pull, I was told that everything is up to date

Zhens-MacBook-Pro:Dailymuses-Server-Side zaikshev88$ git pull origin master
From github.com:mingyeow/Dailymuses-Server-Side
* branch            master     -> FETCH_HEAD
Already up-to-date.

What is the issue here and how can I resolve it?

Upvotes: 3

Views: 3730

Answers (1)

catsby
catsby

Reputation: 11352

Your push command is to remote heroku-production but your pull command is to origin. The non-fast-foward message means the history in your current repo differs from the Heroku remote; likely someone has pushed a branch with some merges or rebases.

I implore you to not use Heroku as the authoritative git remote. Assuming you are not, you can force push over the Heroku master branch to resolve this.

git push -f heroku-production master:master

Upvotes: 10

Related Questions