I was having a
313MB GitLab repository size, until last night I pushed my work to the remote. All files in my local are python scripts, so few
KB of disk usage. I can confirmed all data files are correctly untracked, but suddenly the remote repo size growth to over
10GB size that I cannot push from that moment.
Today, I have trying to fix this since morning without success. I followed the steps outlined in Reduce repository size but couldn’t push back cleaned repo yet. Here’s how I proceeded:
- Exported project bundle.
- Extracted the exported project bundle
$ tar xzf project-backup.tar.gz
- Cloned exported project using
$ git clone --bare --mirror project.bundle Cloning into bare repository 'project.git'... Receiving objects: 100% (1538/1538), 9.73 GiB | 42.98 MiB/s, done. Resolving deltas: 100% (317/317), done.
- changed to
- Analyse repo size:
$ git filter-repo --analyze Processed 1145 blob sizes Processed 128 commits Writing reports to ./filter-repo/analysis...done.
- Deleted files larger than
$ git filter-repo --strip-blobs-bigger-than 10M Processed 1145 blob sizes Parsed 128 commits New history written in 0.10 seconds; now repacking/cleaning... Repacking your repo and cleaning out old unneeded objects Enumerating objects: 1337, done. Counting objects: 100% (1337/1337), done. Delta compression using up to 8 threads Compressing objects: 100% (1034/1034), done. Writing objects: 100% (1337/1337), done. Selecting bitmap commits: 107, done. Building bitmaps: 100% (103/103), done. Total 1337 (delta 285), reused 1318 (delta 270), pack-reused 0 Completely finished after 7.35 seconds.
- Reset origin:
$ git remote remove origin $ git remote add origin https://my_project_name.git
- Force push changes to GitLab. At this stage I encountered problem, that prevented me to proceed further.
$ git push origin --force 'refs/heads/*' Username for 'https://my_project_name.git': my_username Password for 'https://my_project_name.git': Enumerating objects: 435, done. Counting objects: 100% (28/28), done. Delta compression using up to 8 threads Compressing objects: 100% (25/25), done. Writing objects: 100% (435/435), 45.56 MiB | 226.48 MiB/s, done. Total 435 (delta 16), reused 3 (delta 3), pack-reused 407 remote: Resolving deltas: 100% (147/147), done. remote: GitLab: Your push has been rejected, because this repository has exceeded its size limit of 10 GB by 1.8 GB. Please contact your GitLab administrator for more information. To https://my_project_name.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://my_project_name.git.git'
How do I resolve this? Very frustrating.