git:是否可以保存干运行的打包物品并稍后推动它们?

时间:2010-06-10 20:37:04

标签: git git-push

我正在尝试推送一堆包含大量代码和几千个MP3和PDF文件的提交(范围从每个5-40 MB)。

Git成功打包了对象:

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

但它未能推动一些尚未知的原因。

问题在于重新打包文件需要很长时间(我使用的是电池供电的笔记本电脑,需要大约20分钟才能打包)。

所以我想我的问题可以是短语:

  1. 是否可以保存在干运行中创建的打包对象?
  2. 保存后,是否可以推送那些打包的物品并避免重新包装?
  3. 我在git手册和其他地方查了一下,找不到任何结论。

    感谢任何帮助或指示。


    编辑 - 添加了错误消息:

    我第一次从命令行(`git push')运行它时出现了这个错误:

    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'
    

    第二次(git push origin master -v)我收到了这个错误:

    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'
    

    请注意,在这两种情况下,压缩完成后,我都有了这个对话框:

    ---------------------------
    PuTTY Fatal Error
    ---------------------------
    Network error: Software caused connection abort
    ---------------------------
    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)
    

    编辑2 - 根据Charles Bailey的建议运行git gc后,我在大约1.5小时后获得了以下输出:

    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
    

1 个答案:

答案 0 :(得分:0)

如果您运行git gc,那么git将打包存储库中的所有可访问对象。当您随后push时,它似乎会重新打包它需要推送到远程存储库的对象,但它将能够重新使用本地包文件中的打包并且它应该运行很多更快。