Reputation: 93
Due to old unused files, my repo was very big (1.4GB). So I decided to clean it with bf. After a push and clone agin, a du -sh
in my local project give me 70Mo, so it's fine.
But, on my gitlab GUI, the repos is still very big (1.3Go) as you can see here:
I have tried to start an house keeping task in settings, but no change. Have you an idea of how i can reduce the size?
Upvotes: 1
Views: 1823
Reputation: 50540
You've performed the first steps in GitLab's recommendations. The steps below are from their documentation on how to purge files from GitLab storage.
This is going to be a destructive action. You are rewriting repository history.
Install git filter-repo
Generate an export from the project
Download the export from step 2.
Decompress the export: tar xzf backup.tar.gz
This will contain a project.bundle
which was created by git bundle
Clone a fresh copy of the repository from the bundle: git clone --bar --mirror /path/to/project.bundle
Using the previously install git filter-repo
, purge any files from the history of your repository. GitLab provides a couple example commands.
To purge all large files, you will want to use `--strip-blobs-bigger-than`. This example reports files larger than 10 megabytes:
`git filter-repo --strip-blobs-bigger-than 10M`
To purge specific files by path, you can combine both `--path` and `--invert-path`:
`git filter-repo --path path/to/large.mp4` --invert-paths
Cloning from the project.bundle
sets the origin
remote to the local bundle file. This is not wanted, so delete this origin
remote and reset it to your repository.
git remote remove origin
git remote add origin http://gitlab.example.com/<namespace>/<repository>.git
Force push the changes to the repository. This will overwrite all branches. If you have protected branches, you will need to remove branch protection first, run the command below, then re-enable protected branches.
git push origin --force 'refs/heads/*'
If you have large tagged releases, you also need to force push changes to all tags. If you have protected tags, you will need to remove tag protection first, run the command below, then re-enable protected tags.
git push origin --force 'refs/tags/*'
Prevent dead links to commits that were removed, run the following:
git push origin --force 'refs/replace/*'
Within your repository project page, navigate to Settings->Repository
Upload a commit-map
created by the git filter-repo
command. GitLab restricts this to 10M per file, but you can split it and upload piece by piece if needed.
Click Start Cleanup
Upvotes: 1