UFO ET IT

Git 저장소 재 패키지 실패

ufoet 2020. 12. 14. 20:24
반응형

Git 저장소 재 패키지 실패


메모리가 제한된 서버에있는 git 저장소가 있습니다. 서버에서 기존 저장소를 복제하려고하면 다음 오류가 발생합니다.

hemi@ubuntu:$ git clone ssh://hemi@servername.dk/home/hemi/repos/articles
Initialized empty Git repository in /home/hemi/Skrivebord/articles/.git/
hemi@servername.dk's password: 
remote: Counting objects: 666, done.
remote: warning: suboptimal pack - out of memory
remote: fatal: Out of memory, malloc failed
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: early EOF
fatal: index-pack failed
hemi@ubuntu:$ 

이 오류를 처리하기 위해 원래 저장소를 다시 포장하려고했습니다 ( 이 포럼 게시물 에 따라 ). 그러나 저장소를 다시 포장하는 대신 "git pack-objects"명령을 사용하는 방법을 설명합니다.

hemi@servername:~/repos/articles$ git repack -a -d --window-memory 10m --max-pack-size 100m
usage: git pack-objects [{ -q | --progress | --all-progress }]
        [--all-progress-implied]
        [--max-pack-size=N] [--local] [--incremental]
        [--window=N] [--window-memory=N] [--depth=N]
        [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]
        [--threads=N] [--non-empty] [--revs [--unpacked | --all]*]
        [--reflog] [--stdout | base-name] [--include-tag]
        [--keep-unreachable | --unpack-unreachable 
        [<ref-list | <object-list]

Git 1.6.5.7이 서버에 설치됩니다.


솔루션은 로컬 및 원격으로 작업 복사본을 얻었지만 원격 저장소가 자체적으로 다시 포장하기로 결정하면 문제가 다시 발생합니다. 다행스럽게도 두 저장소 모두에서 리 패킹하는 데 필요한 메모리 양을 줄이는 구성 옵션을 설정할 수 있습니다.이 옵션은 기본적으로 리 팩킹 할 때 기본 옵션에 추가 한 명령 줄 매개 변수를 만듭니다. 따라서 원격지에 로그인하고 저장소로 변경하여 다음을 수행해야합니다.

git config pack.windowMemory 10m
git config pack.packSizeLimit 20m

로컬 저장소에서 동일한 작업을 수행 할 수 있습니다. (실수로 저장소가 매우 크거나 메모리가 거의없는 컴퓨터라고 생각합니다.이 값은 저에게 매우 낮은 것 같습니다.)

재 포장에 malloc에 실패를 가져올 때 그것의 가치가 무엇을 위해 매우 과거에 큰 저장소, 나는 또한의 값을 변경 한 core.packedgitwindowsize, core.packedgitlimit, core.deltacachesize, pack.deltacachesize, pack.windowpack.threads하지만 당신은 더 이상 옵션이 필요하지 않은 것처럼 소리 :)


리포지토리에 직접 액세스 할 수 없어서 재 포장을 수행 할 수 없기 때문에 얕은 클론을 수행 한 다음 깊이를 높이면서 점차적으로 가져 오는 것이 도움이되었습니다.

git clone YOUR_REPO --depth=1
git fetch --depth=10
...
git fetch --depth=100
git fetch --unshallow    //Downloads all history allowing to push from repo

여전히 누군가를 도울 수 있기를 바랍니다.


다음 단계를 사용하여 문제를 해결했습니다.

  1. 서버에서 내 로컬 컴퓨터로 저장소를 체크 아웃했습니다 (ssh를 통한 원시 복사본 사용).
  2. 로컬 저장소 재 포장
    git repack -a -d --window-memory 10m --max-pack-size 20m
  3. 서버에 빈 저장소를 만들었습니다.
    git init --bare
  4. 로컬 저장소를 서버로 푸시
  5. 서버 저장소 복제가 가능한지 확인했습니다.

This does not answer the question, but somebody might run into it: repacking might also fail on the server when pack-objects is terminated by some kind of memory killer (such as the one used on Dreamhost):

$ git clone project-url project-folder
Cloning into project-folder...
remote: Counting objects: 6606, done.
remote: Compressing objects: 100% (2903/2903), done.
error: pack-objects died of signal 9284.51 MiB | 2.15 MiB/s   
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: early EOF
fatal: index-pack failed

On Dreamhost this appears to be caused by mmap. The repack code uses mmap to map some files’ contents into memory, and as the memory killer is not smart enough, it counts the mmapped files as used memory, killing the Git process when it tries to mmap a large file.

The solution is to compile a custom Git binary with mmap support turned off (configure NO_MMAP=1).


I am using git version 1.7.0.4 and it accepts this command. It is possible that git version 1.6 doesn't accept this command.

Try creating a new repository with some random commits. Then repack it with this command.


I had the same problem on ubuntu 14.10 with git 2.1.0 on a private github.com repository. (Entreprise router is suspected! Works on different wifi network, except at workplace)

* GnuTLS recv error (-54): Error in the pull function.
* Closing connection 2jects:  31% (183/589)   
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header

My solution was, to git clone using ssh (I set up ssh keys* beforehand), like this:

git clone https://github.com/USERNAME/REPOSITORYNAME.git

becomes:

git clone git@github.com:USERNAME/REPOSITORYNAME.git

*: (Generating an ssh key)

ssh-keygen -t rsa -C "your_email_address_registered_with_github@domain.com"

Then log into github, in settings, import ssh keys, and import it from ~/.ssh/id_rsa.pub.

참고URL : https://stackoverflow.com/questions/4826639/repack-of-git-repository-fails

반응형