I keep getting the following fail with heroku + git...
$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to heroku...
To [email protected]:XXXXXXXX.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:xxx-staging.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
[FAIL]
===== Done...
===== Deleting compiled assets...[OK]
===== Commiting deleted assets...[OK]
===== Done...
$ git pull
Already up-to-date.
Any ideas what I'm doing wrong or should be doing differently to allow for pushing without having to force a push?
Thanks
You simply add your Heroku app as a remote to an existing Git repository, then use git push to send your code to Heroku. Heroku then automatically builds your application and creates a new release.
This error means that the upstream repository has made commits that would be lost if you were to push. First do a "git pull" to merge, and then push again.
Also, just because Heroku uses Git doesn't mean you have to have a Github account (since you mention having to have a premium account). All Github provides is an additional place to store your code if you are working on it in a team. There is absolutely NO REASON that you have to use github to use Heroku.
Git push rejected non-fast-forward means, this error is faced when git cannot commit your changes to the remote repository. This may happen because your commit was lost or if someone else is trying to push to the same branch as you. This is the error you face.
Just force the commit every time you push and it will push it even if there are fast-forward commits. We do this in our development Heroku server all the time since we're all pushing different commits (some further behind than others).
git push -f [email protected]:picasso-staging.git
I don't use jammit for deploying, but you could probably get away with force pushing first and then running the jammit task second. Or check and see if jammit supports a force push flag of some sort.
git push -f REMOTE BRANCH:master #or just master
Force it! Replace REMOTE with your heroku remote name (git remote -v
to view all remotes). Replace BRANCH with the branch you want to push or just put "master" for the master branch.
The problem is that changes have already been pushed and your commit is behind those newer pushes. I'm going to assume you have a master branch and your feature branch still, let's say it's called my_feature
. You can do this and be okay:
git checkout master
git pull
git checkout my_feature
git rebase master
(you may have to fix some conflicts here, if any are found)
git checkout master
git merge my_feature
git push heroku
You should remember to run any tests you have to make sure everything's good still.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With