Search code examples
gitrepo

Update Git remote : object directory


I need some help.. how can I update git repository in remote after doing this cleanup?

In local my .git directory, size is 1.7GB only, and in remote I have 40GB size. How can I update the remote to make it 1.7GB, same as in my local? One thing that makes 40GB is the object directory in .git, I clean it up in my local and now it is now 1.7GB, how can I push this update?

I used this command to clean up:

 git gc --aggressive --prune

Solution

  • The git gc command performs garbage collection on the local repository only. This is not something you can push to a remote.

    If you are in control of the remote, you can perform a garbage collection on it as well. How exactly to do that really depends on the software you are using (e.g. gitolite, Gitlab, Bitbucket...)

    If you are using a service such as Github, they take care of this automatically themselves, you don't need to do anything.