Home > Net >  Heroku bad line length failed to push some refs
Heroku bad line length failed to push some refs

Time:03-07

I'm trying to upload changes to Heroku via:

git commit -am "make it better"
git git push heroku master:main

Unfortunately I keep getting this error:

fatal: protocol error: bad line length 81926.25 MiB/s   
error: failed to push some refs to 'https://git.heroku.com/purgescan.git'

I don't understand why because It seems to write like 4 GB worth of objects and I'm not sure why. I can't pull any changes, and nothing I do seems to fix this.

I tried to commit a 7 GB file (to train my machine learning model), but it failed. But for some reason I think Heroku thinks I did commit the file or something, but I can't do anything about since It won't let me commit changes.

I did git add <<7GB NLP training file>>, then I did git commit and git push.

CodePudding user response:

I tried to commit a 7 GB file (to train my machine learning model), but it failed. But for some reason I think Heroku thinks I did commit the file or something, but I can't do anything about since It won't let me commit changes.

Committing and pushing are different things. Your push is failing, but that doesn't mean the commit failed. It isn't that Heroku "thinks" you committed the file; you actually committed the file.

Your repository almost certainly shouldn't contain a 7GB data file. I suggest you remove it. You'll have to actually remove the entire commit, otherwise it will still be in your repository's history and contribute to its size.

Assuming the commit you need to remove is the last one on your branch, you should be able to do something like this:

  1. First, reset your local branch to the previous commit:

     git reset --hard HEAD~
    
  2. Then, push that change to Heroku (assuming your remote is called heroku):

     git push --force-with-lease heroku
    

If you want that file to still be in your working directory you might want to add it to your .gitignore file.

  • Related