Git pull因错误的包头错误而失败

时间:2011-09-09 13:53:24

标签: git

git pull失败,出现以下错误

remote: Counting objects: 146, done.
remote: fatal: unable to create thread: Resource temporarily unavailable
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

任何想法如何成功拉动?

5 个答案:

答案 0 :(得分:50)

remote开头的行是从远程系统上运行的git输出的。错误:

fatal: unable to create thread: Resource temporarily unavailable

...强烈建议您在服务器上耗尽内存,如果您有以下情况,可能会发生这种情况:

  1. 包含大量大文件的存储库,可能导致重新打包以占用大量内存。
  2. 有限的虚拟内存 - 一般情况下或由于ulimit设置
  3. 而仅针对该帐户

    建议here是通过登录远程系统(作为git运行的用户)并执行以下操作来限制打包可能占用的内存量:

    git config --global pack.windowMemory "100m"
    git config --global pack.packSizeLimit "100m"
    git config --global pack.threads "1" 
    

答案 1 :(得分:1)

警告:如果您在Git 2.19.1中看到此错误,这是预料之中的,并记录在git-for-windows/git issue 1839中:“ git gc在计数对象的33%时崩溃”(这将报告两个都为APPCRASH git gc,但{{1}的也是),因为“ git pack-objects”中使用了互斥锁,该互斥锁未正确初始化并导致“ git pull”在Windows上转储内核。

如问题中所述:

  

它不仅影响git repack,而且影响更大。我也用gc击中了它的一个变体:

pull

此问题已在Git 2.20(Q4 2018)中修复。
请参见commit 34204c8commit 9308f45commit ce498e0Johannes Schindelin (dscho)(2018年10月16日)。
(由Junio C Hamano -- gitster --commit 620b00e中合并,2018年10月30日)

  

$ git pull remote: Enumerating objects: 3548, done. error: git upload-pack: git-pack-objects died with error. fatremote: aborting due to possible repository corruption on the remote side. al: git uploadf-pack: aborting due to possible repository corruption on the remote side. atal: protocol error: bad pack header (mingw):在正确的位置初始化pack-objects互斥锁

     

9ac3f0epacking_data:解决打包大增量的性能问题中,2018-07-22,Git v2.19.0-rc1)中引入了互斥锁,用于保护对设置增量大小。该提交甚至添加了代码来对其进行初始化,但是在不正确的位置:在pack-objects中,而对init_threaded_search()(因此对oe_set_delta_size())的调用可能发生在调用链{{1 }} <-{packing_data_lock() <-check_object() <-get_object_details(),这比prepare_pack()函数调用cmd_pack_objects()(初始化线程搜索)早了。 / p>      

另一个说明互斥锁已在不正确的地方初始化的故事是,用于初始化互斥锁的函数位于内建/中,而使用互斥锁的代码在prepare_pack()头文件中定义。

答案 2 :(得分:0)

更新:这个回答是Mark Longair回答的编辑建议,现在已经用正确的命名更新了他的答案。

事实上,pack.SizeLimit不正确,它是pack.packSizeLimit

当我添加此选项时,它对我有用:)

我必须在本地和远程存储库中设置它。

答案 3 :(得分:0)

补充 @Mark Longair 的答案

我必须运行以下命令来解决此问题:

git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1" 
git config --global pack.deltaCacheSize "512m"

您可以在git文档git config中查看有关这些命令的更多信息。

答案 4 :(得分:-1)

我能够使用以下步骤解决此问题

步骤1.使用较小的深度进行克隆

git clone https://your_git_clone_url-深度3

步骤2。编辑.git / config并添加要开发的行。这是必需的,因为设置深度后,我无法切换除master以外的远程分支

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = https:<your git clone url>
    fetch = +refs/heads/master:refs/remotes/origin/master
    fetch = +refs/heads/develop:refs/remotes/origin/develop  <<--- Add this line
[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "develop"]
    remote = origin
    merge = refs/heads/develop

第3步:获取

相关问题