Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git gc and git prune warnings when git fetch origin is run

Working with remote repository at some moment I started recieving this when I run git fetch origin

Auto packing the repository in background for optimum performance.

See "git help gc" for manual housekeeping.

warning: The last gc run reported the following. Please correct the root cause and remove .git/gc.log.

Automatic cleanup will not be performed until the file is removed.

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

This happens all the time. I found somewhere that git gc should help but it works only once (or seems to work) - after this and following git fetch origin I get

Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping.

Later the situation repeats. I also tried to remove .git/gc.log - it doesn't help.

My git skills are really limited. Why do I get this warnings and how to fix the issue for long?

like image 707
Dmitriy Metelya Avatar asked Dec 06 '25 17:12

Dmitriy Metelya


1 Answers

This article helped me -

git fsck
git gc --prune=now
git prune  
git gc

And error should vanish.

Reference - https://medium.com/lynns-dev-blog/git-there-are-too-many-unreachable-loose-objects-c2df601b8001

like image 91
ShaileshAher Avatar answered Dec 08 '25 06:12

ShaileshAher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!