Error on pushing to heroku
See original GitHub issueI’m using this action and I have the following error message while the aciton tries to push to heroku.
remote: ! Push rejected, source repository is a shallow clone. Unshallow it with `git fetch --all --unshallow` and try pushing again.
remote:
To https://git.heroku.com/laborsord.git
! [remote rejected] HEAD -> master (shallow update not allowed)
error: failed to push some refs to 'https://git.heroku.com/laborsord.git'
##[error]Error: Command failed: git push heroku HEAD:refs/heads/master
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
I cannot push to Heroku git. I see an error starting with fatal
When pushing my code to Heroku git through its HTTPS URL, I see an error like fatal: protocol error: bad line length character:...
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 >Error: Command failed: git push heroku HEAD:refs ... - GitHub
This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint:...
Read more >Why getting error when I am trying to run: git push heroku master
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. remote: See https://devcenter.
Read more >Heroku deploy failure - Top 3 error newbies always have
When you deploy failed a simple app to Heroku, you may encounter various types of error. This video is a guide to fix...
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
Alright so to fix this problem, all you wanna do is switch the version of actions/checkout from
v1
tov2
and remove the fetch-depth optionAnd to try and explain to you the problem, originally in v1 of the actions/checkout, the action was making a complete clone of the repo (or an unshallow clone) but later on in v2, the team at github decided to make the action perform shallow clones instead (and that’s what started this issue in the first place). So to try and circumvent this, I decided to add the
command as built into this action’s (heroku-deploy) code. But now the action only works on shallow clones 😅 (since the action makes them unshallow anyway). I did this because I suspected most people would use v2 of the actions/checkout action and wouldn’t think to add the fetch-depth: 0 flag so by having unshallowing built into the heroku-deploy action, they wouldn’t even need to think about it. But its pretty clear now I’ll need to work on a more elegant situation which I will do in the next release.
FOR THE TIMEBEING THOUGH, FOR ANY FUTURE USERS RUNNING INTO THIS ISSUE, make sure that you are using
v2
of the actions/checkout action and you have not set the fetch-depth: 0 flag exactly as given in the documentation. I’m gonna try adding the shallow and unshallowing issues in the docs as well (atleast until I can find a way to circumvent it)P.S @balexandre sorry for the late reply, I suspect we live in different timezones and I was asleep when you commented
Actually I think I found the problem, in the official docs for the actions/checkout@v1 github action, it says
The second line says that by default, the action only fetches one commit. That could be the reason why the clone is coming off as a shallow one. To fix this, try adding the following line in your main.yml inside your .github/workflows folder:-
And hopefully that fixes it