githeroku

Heroku/Git: protocol error: bad line length character: erro


When I deploy to heroku via git, the slug build finishes successfully but after that I get an git protocol error:

$ git push heroku -f v0.0.20:refs/heads/master

(...)    

remote: -----> Compressing...
remote:        Done: 55.3M
remote: -----> Launching...
remote:        Released v40
remote:        https://....herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
fatal: protocol error: bad line length character: erro
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'https://git.heroku.com/....git'

I've tried to SSH manually into the git server to debug that, but without success, tcpdump is useless due SSL.

ssh git@heroku.com "git-upload-pack ....git" produces nothing suspicious:

00c93a701c509d5730ba92e91463707699721929d477 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed symref=HEAD:refs/heads/master agent=git/1.9.1
003f3a701c509d5730ba92e91463707699721929d477 refs/heads/master
0000

I had contact to the heroku support and they tried to push the same code to the same app, but that worked.

I'd be thankful for any advice how to debug that issue.


Solution

  • It's hard to debug that, but meanwhile I found out what's going on:

    I've pushed the code with following command:

    git push heroku -f v0.0.20:refs/heads/master
    

    By changing the remote from an HTTPS URL to an SSH URL, I got an useful error message: error: Trying to write non-commit object a3ab0fb2fda8d778850b3cbfc88e7e865d95daac to branch refs/heads/master

    Which lead me realize, that I can't push an git tag object to a remote branch ref.

    There's a simple solution for that issue:

    git push heroku -f v0.0.20^{}:refs/heads/master
    

    From the gitrevisions man page:

    <rev>^{}, e.g. v0.0.20^{} A suffix ^ followed by an empty brace pair ({})means the object could be a tag, and dereference the tag recursively until a non-tag object is found.

    With other words: Find the last commit, which the tag references.