Git push results in "fatal: sha1 file '<stdout>' write error: Invalid argument" error

git, heroku

Solution

Is this happening on every deploy? You will occasionally see network failures when pushing to Heroku's git remote.

I've always been able to work around this by re-pushing. If Heroku thinks the latest commit has already been pushed, create a NOOP commit and force-deploy it:

touch foo.txt
git add foo.txt
git commit -m 'NOOP'
git push heroku --force

...and if that works, you can remove the NOOP commit you made locally:

git reset --hard origin/master

Problem

After sleuthing for about 3 hours now I managed to give myself a headache and not found a fix to this error: ``` Compressing objects: 100% (228/228), done. Write failed: The connection was abortediB | 3 KiB/s fatal: sha1 file '<stdout>' write error: Invalid argument error: failed to push some refs to 'git@heroku.com:---------.git' ``` I am pushing a commit to heroku, and the above is thrown out. How do I fix this?

Original source