meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git:issues [2017/03/01 11:45] niziakgit:issues [2023/07/17 16:02] (current) niziak
Line 1: Line 1:
 +====== Issues ======
 +
 +====== fsck: dangling commit =====
 +
 +List details about dangling commits ([[https://lukescott.co/2019/05/10/git-finding-lost-dangling-commits/|Git – Finding Lost/Dangling Commits]]:
 +<code bash>
 +git fsck --lost-found | grep "^dangling commit" | sed "s/^dangling commit //g" | xargs git show -s --oneline
 +</code>
 +
 +Cleanup:
 +<code bash>
 +git reflog expire --expire=now --all
 +git gc --prune=now --aggressive
 +git repack -a -d
 +</code>
 +
 +====== Reduce repo size ======
 +
 +
 +It is important to check if git configured with default settings.
 +Especially forcing of creation of multiple smaller packs significantly increases repository size.
 +I.e. changing one 1.2G pack into multiple 256MB packs let, increases size of packs to 4.3GB :(
 +<code bash>
 +git config --global -l
 +git config --system -l
 +</code>
 +
 +Especially take attention for options like:
 +  *  deltaCacheSize = 10m
 +  *  packSizeLimit = 10m
 +  *  windowMemory = 10m
 +
 +
 +Command <code bash>git gc</code> and other cleaning commands requires whole repository to be read into memory. For big repos (like kernel.git) it requires to allocate over 8GB of RAM.
 +Compression of objects is also performed in RAM, then packs are written onto disc.
 +[[https://stackoverflow.com/questions/42175296/git-gc-uses-a-lot-of-memory-even-i-limited-it]]
 +
 +
 +To prevent touching existing packs and exhaust system memory paramter ''auto'' should be used. <code bash>git gc --auto</code>
 +Another possibility is to mark some packs as ''keep'' by creating .keep files. 
 +
 +Remove unreachable objects:
 +<code bash>
 +
 +git count-objects -v
 +git gc  --auto # this is enough to remove loose objects and repack repo
 +git count-objects -v
 +
 +# more instruction
 +git repack -Ad # Remove dangling objects from packfiles
 +git prune # Remove dangling loose objects
 +git gc --aggressive --prune=now --force  || rm -f .git/objects/*/tmp_* && rm -f .git/objects/*/.tmp-*
 +
 +git count-objects -v
 +</code>
 +
 +
 +
 ====== error: pack-objects died of signal 9  ====== ====== error: pack-objects died of signal 9  ======
  
 git was killed by host monitor process or oom due to memory usage. git was killed by host monitor process or oom due to memory usage.
 Check syslog for OOM entries. Check syslog for OOM entries.
 +
 +Solution:
 +<code bash>
 +[core]
 +    packedGitLimit = 32m
 +    packedGitWindowSize = 32m
 +    deltaCacheSize = 10m
 +</code>
 +
 +Disable compression:
 +<code bash>
 +git config core.compression 0
 +git config core.loosecompression 0
 +git config pack.window 0
 +</code>
  
  
Line 17: Line 90:
 But if git binary from gitlab is used But if git binary from gitlab is used
 <code bash>sudo -u git -H "/opt/gitlab/embedded/bin/git" config -l</code> <code bash>sudo -u git -H "/opt/gitlab/embedded/bin/git" config -l</code>
 +
 +<code bash>
 +/opt/gitlab/embedded/bin/git --git-dir=/home/git-data/repositories/funny/linux.git config -l
 +/opt/gitlab/embedded/bin/git --git-dir=/home/git-data/repositories/funny/linux.git bundle create /tmp/linux.bundle --all
 +</code>
 +
 then, file  ''/opt/gitlab/embedded/etc/gitconfig'' is used. then, file  ''/opt/gitlab/embedded/etc/gitconfig'' is used.
 To modify this file: To modify this file:
  
 <file ruby gitlab.rb> <file ruby gitlab.rb>
-omnibus_gitconfig['system'] = { "receive" => ["fsckObjects true"], +omnibus_gitconfig['system'] = {
-                                "core" => ["packedGitLimit 40m", "packedGitWindowSize = 40m"], +    "core    => ["packedGitLimie 32m", "packedGitWindowSze = 32m", "deltaCacheSize = 32m" ], 
-                                "pack" => ["deltaCacheSize = 40m", "packSizeLimit = 40m", "windowMemory = 40m", "threads = 1"} +    "receive => ["fsckObjects true"], 
 +    "pack"     => ["deltaCacheSize = 32m", "packSizeLimit = 32m", "windowMemory = 32m", "threads = 2" ] 
 +}
 </file> </file>
 +
 Test config: Test config:
-<code>gitlabctl show-config</code>+<code>gitlab-ctl show-config</code>
 Regenerate config: Regenerate config:
-<code>gitlabctl reconfigure</code>+<code>gitlab-ctl reconfigure</code>