Whole team gets 'too many unreachable loose objects' messages

I face same issue and above solution did not solve my problem. I was getting the same issue that says :

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

I have refer this link and run the following command it got resolved : git gc

eg : /xx/code/home/xx is my git repositry home path.

(base) laxman@xxxxx:/xx/code/home/xx$ git gc
Counting objects: 251571, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (78004/78004), done.
Writing objects: 100% (251571/251571), done.
Total 251571 (delta 141562), reused 245636 (delta 137343)

Hope it will work for some others as well.


This is followed by issue 14357 (GitLab 8.6- or less)

The manual fix was:

  • SSH into worker1
  • cd into the gitlab-org/gitlab-ce directory
  • ran rm gc.log, this just contained the line " warning: There are too many unreachable loose objects; run 'git prune' to remove them."
  • ran git prune and prayed it didn't break things (which it thankfully didn't)

But it looks like, starting GitLab 8.7, auto gc is disabled.
This is also done in the context of (still opened) issue 13524:

Typically after a rebase, amend or other action that requires a force push we can have dangled commits.

Such "dereferenced" commits are getting lost due to git gc that may be executed internally or by using GitLab Housekeeping features.

If it happens that there was a discussion attached to a specific commit - it is not available after dereferenced commit has been garbage-collected.

Commits are being recorded in push events and are available through system notes added to merge request, and currently this produces error 500 in GitLab.

Update: that issue was closed a month later (July 2016) with:

  • MR 5062: Don't garbage collect commits that have related DB records like comments

Makes sure a commit is kept around when Git garbage collection runs.
Git GC will delete commits from the repository that are no longer in any branches or tags, but we want to keep some of these commits around, for example if they have comments or CI builds.

  • MR 4101: Refactor: Convert existing array-based diff refs to the DiffRefs model