heroku-deploy: Error: Command failed: git push heroku HEAD:refs/heads/main --force

Error I received

image image

My file:

name: Deploy

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install packages
        run: npm install
      - name: Build project
        run: npm run-script build
      - uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
        with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: ${{secrets.HEROKU_APP_NAME}} #Must be unique in Heroku
          heroku_email: ${{secrets.HEROKU_EMAIL}}
          procfile: 'web: npm start'

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 22
  • Comments: 33 (4 by maintainers)

Most upvoted comments

Interestingly for me just regenerating the deploy token fixed the problem.

TL;DR: Ensure your secrets are defined and accessible.

For those of you discovering this issue today, I had the same problem. I determined it was being caused by the HEROKU_API_KEY not being defined in secrets for the repository. The error message is something of a misnomer as it shows successfully logged into heroku in the output, despite that clearly not being the case (in our instance).

HTH

In my case updating secret API_KEY and EMAIL_ID again, worked for me!

@IshaanOhri I couldn’t wait for a fix or a response from the developers, so I started using Heroku’s automatic deploy. 😄 I removed the deployment part from my workflow and left only the steps that executes before (running tests, lint, etc). And then, on Heroku, I enabled the option to run deploy only on a specific branch (in this case, the main) and only after the CI has successfully run.

<kbd>image</kbd>

Maybe you should try, cheers.

Error I received

image image

My file:

name: Deploy

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install packages
        run: npm install
      - name: Build project
        run: npm run-script build
      - uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
        with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: ${{secrets.HEROKU_APP_NAME}} #Must be unique in Heroku
          heroku_email: ${{secrets.HEROKU_EMAIL}}
          procfile: 'web: npm start'

You just need to configure the secrets on GitHub image You can get HEROKU_API_KEY from account settings on Heroku Account image

Hey everyone, sorry about the extremely delayed response (COVID-19 + College is making it hard to stay on track with this). But I have been working on a fix on this for a while, I haven’t been able to resolve it yet. My suspicion is that these could likely be multiple issues layered behind a common logging message (so there’s obviously a need to improve the logging on these things). I am working on this, I’m not quite near a fix yet but I am working. I’ll try and keep updated from now on and hopefully resolve this in a new release soon

github_heroku

I think the problem is heroku app is using master branch as a default branch .

I got this issue after resetting my heroku login/password. I had to regenerate new tokens and it fixed the issue

"git push heroku main " is not uploading. It is showing error: src refspec main does not match any error: failed to push some refs to ‘https://git.heroku.com/arcane-lowlands-81668.git’ was anybody able to resolve the issue?

I’ll have an update by tomorrow