Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative way to do an initial push of a large repo

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 '[email protected]: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!

like image 933
snowangel Avatar asked Dec 29 '11 20:12

snowangel


2 Answers

I was trying to push some changes with videos and got:

fatal: The remote end hung up unexpectedly
error: pack-objects died of signal 13
error: failed to push some refs to '[email protected]/XXX.git'

The solution for me was:

git repack
git push 

Hope this will help

like image 59
Lord of freaks Avatar answered Sep 18 '22 16:09

Lord of freaks


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.

like image 39
Adam Dymitruk Avatar answered Sep 19 '22 16:09

Adam Dymitruk