0

I am now working on a website. I use heroku to run my server and use bitbucket as the version control tool. I setup a pipeline to deploy directly from bitbucket to heroku. But I keep getting an error like:

+ git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD

To https://heroku:57eb7889-7395-4a7e-bd95-1312a40b30d1@git.heroku.com/hidden-ocean-90048.git ! [rejected] HEAD -> master (non-fast-forward) error: failed to push some refs to 'https://heroku:57eb7889-7395-4a7e-bd95-1312a40b30d1@git.heroku.com/hidden-ocean-90048.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I tried git pull and git pull -f but it doesn't work. Please help me.

KyrioZ
  • 21
  • 3

1 Answers1

1

You can push with -f like the below:

git push -f https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD
Hamdi Bayhan
  • 1,773
  • 4
  • 17
  • 20
  • How would you do when you use `subtree` for deploying e.g. `git subtree push --prefix folder_name heroku master` where the `-f` flag does not work? – martin36 Apr 02 '19 at 19:23
  • @martin36 I didn't use with subtree before so I don't know how does it work. – Hamdi Bayhan Apr 03 '19 at 09:31