question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Issue Description

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'

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:20
  • Comments:32 (4 by maintainers)

github_iconTop GitHub Comments

20reactions
rbclarkcommented, May 19, 2022

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

16reactions
DrPepcommented, May 19, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't I deploy to Heroku in GitHub Action: `Command ...
Specifically, the error was: Error: Command failed: git push heroku HEAD:refs/heads/main. and decide whether you wish to modify your GitHub ...
Read more >
Deploying with Git - Heroku Dev Center
To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your...
Read more >
Heroku Deployment Failed To Push Some Refs? - ADocLib
Error : Error: Command failed: git push heroku HEAD:refs/heads/main force #68. Closed. IshaanOhri opened this issue on Feb 19 10 comments. Continue to...
Read more >
heroku: [solved] failed to push some refs - DEV Community ‍ ‍
In my case, I got the error because my github default branch isn't master but main . So in my situaton instead of...
Read more >
Newbie - How do I deploy to Heroku with Github Actions?
Error : Error: Command failed: git push heroku HEAD:refs/heads/main -- force fatal: 'heroku' does not appear to be a git repository fatal: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found