6

Heroku thinks I'm on a "different branch", but I am not (and the same version of the code most definitely has not "been built" as claimed):

remote:  ! ## Warning - The same version of this code has already been built: e437cb472232ed140fa6dd710e8b4a6b16b8b213
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version e437cb472232ec180fa6dd700e8b4a6b1ab8b213
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version

The mentioned article says

This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.

In any case, I ran

git push heroku master:main

as requested and it gave the warning, but I deployed anyway (which it wasn't doing before with git push heroku master).

The app deployed, which means the problem is solved. But I am confused as to what happened here to cause the application to not deploy without the special command above.

I am not sure if this is some weird problem with Heroku or if it's some new change at GitHub? (I know they were planning to change the word 'master' to 'main' - I wonder if that is the reason?, or if this is simply some changes to Heroku, possibly just temporary ones given the message on the referenced article?)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
stevec
  • 41,291
  • 27
  • 223
  • 311

4 Answers4

5

What worked for me was

git push heroku master:main

And it all worked (I am not sure why this was necessary, though).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
stevec
  • 41,291
  • 27
  • 223
  • 311
5

Mine worked with:

git push heroku HEAD:master

raba64577
  • 81
  • 2
  • 5
2

This solution worked for me:

Add and checkout a new branch

git checkout -b tes

And push it to the branch above:

git push heroku tes
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I just wanted to add that I need to run git add and then git commit before proceeding, and then it worked with

git push heroku master
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • can you please be more elaborative on how did this worked for you? As per the question, I can clearly see that the user has to push the code to the remote main branch, which your git command won't do. So, can you please validate and correct your answer – Pratap Alok Raj Jun 04 '21 at 15:14