I’ve got a largish Rails 3.1 app in development and production which I’ve only just set up a staging environment for on Heroku. Because my git repo is quite large, I’m getting time-out errors at around 33% every time I try to push.
Is there an alternative to doing git push staging master for this initial giant push?
The error message is
EmBP-2:Appname Emma$ git push staging master
Counting objects: 17421, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6363/6363), done.
Connection to 10.10.18.33 closed by remote host.46 KiB/s
error: pack-objects died of signal 13
error: failed to push some refs to 'git@heroku.com:appname-staging.git'
///////////////////
SOLUTION / EDIT, many months later…
There’s a sneaky way to solve this, nowadays, using Heroku’s (experimental) Pipeline feature, if you already have an environment set up to which you’ve pushed the code. From the Heroku docs:
“For example, you can push code to staging, have it built into a slug and later promote the staging slug to production.”
Takes about 5 seconds for Heroku to push the existing slug from one app to another!
The alternative is to break apart your giant commit into many small ones. Tag or branch before you do this. Each will have a number of files that constitutes a reasonable push. Make a temp branch to point to the tip. Now reset master to the first of those smaller commits. Push. Set master to the next commit. Push. Repeat this until done.
Now restore master to where it was originally. You already transferred the objects. Pushing this large commit should not resend all the objects that already exist at the remote.