tags:

views:

52

answers:

1

I'm trying to push a bunch of commits that contain a lot of code and a few thousand MP3 and PDF files besides (ranging from 5-40 MB each).

Git successfully packs the objects:

C:\MyProject> git push
Counting objects: 7582, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7510/7510), done.

But it fails to send the push for some as yet unknown reason.

The problem is that it takes it a very long time to repack the files (I'm on a battery-powered laptop and it took about 20 minutes to pack).

So I guess my question can be phrases thus:

  1. Is it possible to save the packed objects created in a dry run?
  2. Once saved, is it possible to push those packed objects and avoid repacking?

I looked it up in the git manual and elsewhere and couldn't find anything conclusive.

Any help or pointers are appreciated.


EDIT - Added the error messages:

The first time I ran this from the commandline (`git push') I got this error:

fatal: sha1 file '<stdout>' write error: Invalid argument
error: pack-objects died with strange error
error: failed to push some refs to 'account@server:project.git'

The second time (git push origin master -v) I got this error:

Pushing to account@server:project.git
Counting objects: 7582, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7510/7510), done.
fatal: sha1 file '<stdout>' write error: Invalid argument
error: pack-objects died with strange error
error: failed to push some refs to 'account@server:project.git'

Note that in both cases, after the compression finished, I got this dialog:

---------------------------
PuTTY Fatal Error
---------------------------
Network error: Software caused connection abort
---------------------------
OK   
---------------------------

While the dialog was open, the console read as follows (the "Writing objects" line was erased after clicking OK):

Pushing to account@server:project.git
Counting objects: 7582, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7510/7510), done.
Writing objects:   0% (1/7525)

EDIT 2 - After running git gc per Charles Bailey's suggestion, I got the following output after about 1.5 hours:

C:\Projects\MyProject>git gc
Counting objects: 10926, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (10125/10125), done.
warning: failed utime() on c:/Projects/MyProject/.git/objects/.tmp-10596-pack-a3a5ef775308593167a669b19aa752d2f484f768.pack: Permission denied
warning: failed utime() on c:/Projects/MyProject/.git/objects/.tmp-10596-pack-380270a0b5f3c7d30731c8e19f9271a59ea05e3d.pack: Permission denied
Writing objects: 100% (10926/10926), done.
Total 10926 (delta 719), reused 10858 (delta 719)
mv: cannot move `/c/Projects/MyProject/.git/objects/pack/pack-5dc233ff7aa1c33fc4845251186d5bafcefe3a11.pack' to `/c/Projects/MyProject/.git/objects/pack/old-pack-5dc233ff7aa1c33fc4845251186d5bafcefe3a11.pack'
error: failed to run repack
A: 

If you run git gc then git will pack all reachable objects in your repository. When you subsequently push, it will appear to repack the objects that it needs to push to the remote repository but it will be able to re-use the packed for that are in your local pack file and it should run a lot faster.

Charles Bailey
Thanks. It looks exactly like what I was looking for. Unfortunately, I'm still getting errors. I've updated the question (look for `EDIT 2`) with the results. Any idea what could have caused the permission denied issue?
shovavnik
By the way, I can see the pack and index file mentioned in the output in .git/objects/pack folder. The folder also has the other two index/pack file pairs that were mentioned with the "warning: failed utime()" messages. Are these pack files corrupt? old? Can I (should I) use them?
shovavnik
@shovavnik: I'm not sure what the 'failed utime' message means but if they're named `pack-*` and not `.tmp.pack-*` then they should be fine. You may be able to transfer them to the server using another transport mechanism and use `git unpack-objects <pack*.pack` to exand them into the repository. After this a normal push should be able to update the remote references quite cheaply.
Charles Bailey
After I replied yesterday, I tried to do a `git push` to see what would happen. Incredibly, it worked. `git gc` seems to have done the trick.
shovavnik
Even more incredibly, it still hasn't finished. It's been uploading at a steady 30 KiB/s for the past 20 hours. Is there any way to speed this thing up? The closest git config setting I could find was `lowSpeedLimit`, but that aborts the upload instead of speeding it up.
shovavnik
Sorry it took me so long to get back to you. `git gc` definitely did the trick. It still took a few days to upload and the intervention of the host (they had to up the quota for a few days and then re-pack and clean up on the server to delete the temp upload files and get back under the quota). But I wouldn't have figures this all out without your help. Thank you!
shovavnik