Error: Command failed: git push heroku HEAD:refs/heads/main --force
See original GitHub issueError I received
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:
- Created 2 years ago
- Reactions:20
- Comments:32 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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