2

I need to deal with a git repository hosted on a gitlab instance. The repo.git/objects folder is 3.8GB large on the server's filesystem (it the same same as reported in GitLab's UI).

However when I'm cloning it with git --mirror remote-url, it's only 120MB large... !?

I've read http://stevelorek.com/how-to-shrink-a-git-repository.html and indeed there are remotes branch, but even after following the "deep clone" step and issuing git fetch --all I don't see any differences. What's happening here ?

My ultimate goal is then to shrink/cleanup the repo on disk, of course.

martin-h
  • 69
  • 1
  • 8
  • Try `git clone --mirror`. There might be some pull-request-like refs, which are not merged to branches. – ElpieKay Jun 13 '18 at 08:51
  • adding `--mirror` has the same exact effect – martin-h Jun 13 '18 at 09:15
  • See https://stackoverflow.com/questions/7348698/git-how-to-list-all-objects-in-the-database. List all objects in both repositories, sort and compare two results. – ElpieKay Jun 13 '18 at 09:18
  • Thanks @ElpieKay but... Then what ? – martin-h Jun 13 '18 at 09:48
  • Find the difference and what are missing. Objects are the meta data of a git repository. If they are the same, maybe the Gitlab repo needs `git gc`. – ElpieKay Jun 13 '18 at 10:00
  • They are clearly not the same : I gathered both objects lists and there are more in the one on the filesystem. Could it be something linked with LFS ? – martin-h Jun 13 '18 at 10:28
  • I can't see any LFS files with `git lfs ls-files` from a regular clone of the repo. – martin-h Jun 14 '18 at 07:14

1 Answers1

1

fixed the issue with sudo -u git git gc

GC is ran by GitLab only after a specific number of push cycles

See https://docs.gitlab.com/ce/administration/housekeeping.html

martin-h
  • 69
  • 1
  • 8