Deployment to Heroku Push Rejected

Situation

  • The application I try to deploy is in a subfolder in GitHub.
  • Test with CircleCI are running fine by passing the folder path (build_dir) in the general section of the circle.yml
  • the ruby version I speficfied as 2.2.0 in the machine section of the circle.yml
  • for the deployment I added the deployment section with the staging part as described in the howto step 3

When running the build and reaching the point where the deployment starts the build will fail (see error message log below)

How can I make sure that CircleCi is passing the correct path to Heroku? The Gemfile is available in the subfolder of the application in GitHub repository.

I already tried it the following way as I read that I might be automatically in the application folder without success.
commands:
- “[[ ! -s “$(git rev-parse --git-dir)/shallow” ]] || git fetch --unshallow”
- cd … && git push git@heroku.com:herokuapplication.git master

Does anybody has the same issue and found a solution?

ERROR MESSAGE in deploy to herokuapplication stage of the build process.
Warning: Permanently added ‘heroku.com,xx.yy.zz.aa’ (RSA) to the list of known hosts.

Counting objects: 2184, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (1574/1574), done.
Writing objects: 100% (2184/2184), 18.07 MiB | 20.60 MiB/s, done.
Total 2184 (delta 1300), reused 1008 (delta 539)
remote: Compressing source files…remote: Compressing source files… done.
remote: Building source:
remote: ! Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the buildpack
remote: to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: Verifying deploy…remote: Verifying deploy…
remote:
remote: ! Push rejected to ala-lcm-information-hub.
remote:
To git@heroku.com:herokuapplication.git
! [remote rejected] git@heroku.com:herokuapplication.git -> master (pre-receive hook declined)
error: failed to push some refs to ‘git@heroku.com:herokuapplication.git’

((git push "git@heroku.com:herokuapplication.git" "git@heroku.com:herokuapplication.git:refs/heads/master")) returned exit code 1((git push "git@heroku.com:herokuapplication.git" "git@heroku.com:herokuapplication.git:refs/heads/master")) returned exit code 1

Action failed: Deploy to herokuapplication

Hi all,
in between I was able to find a solution for this problem on my own - my this will help somebody in the future as well.

To make the deployment to heroku working I need to add the following to the circle.yml

> deployment:
>   staging:
>     branch: master
>     commands:
>       - git remote add heroku git@heroku.com:herokuapplicationname.git
>       - "[[ ! -s \"$(git rev-parse --git-dir)/shallow\" ]] || git fetch --unshallow"
>       - cd ../../.. && git subtree push --prefix GitHubPath/to/application heroku master

with the cd …/…/… && you may need to play a round a little bit. I needed to add it to root out of the path I was in and then to reopen the path with the subtree option. As you can see the amount of subfolders I need to go back.
–> cd …(for application)/…(for to)/…(for GitHubPath)

1 Like

Thank you so much for posting the solution here!

i have the same problem, but it feels quite weird; obviously if you follow the current process (github › circle › heroku), your folder will have github as the origin master and won’t know much about heroku repo
At the same time, the process seems to work out of the box, not dissing it, but the solution looks quite complicated… am i wrong to think that way ? Isn’t there a more straightforward alternative ? I might lack of corrupt understanding about how things work maybe