I use git for my project. We develop this project about 2 year. Now this .git file is 908,3 MB. I think this size not normal so i want to decrease file size of git. So how to fix them? thank you.
Asked
Active
Viewed 449 times
1 Answers
2
Try and purge the history of the repository for large file: use the new tool git filter-repo
which replaces BFG and git filter-branch
.
git filter-repo --strip-blobs-bigger-than 10M
Check the size of the .git
folder then.
Make sure those large files were not needed in your repo history.
Note: if you get the following error message when running the above-mentioned commands:
Error: need a version of `git` whose `diff-tree` command has the `--combined-all-paths` option`
it means you have to update git
.

Zeitounator
- 38,476
- 7
- 53
- 66

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
When i tried it say that "Error: need a version of git whose diff-tree command has the --combined-all-paths option" – Ali Yaman Jan 12 '20 at 13:51
-
I updated my git version after that it worked. If i choose 1m, could it be an error? ( Also this code doesn't not change git file so i can't push on my repo) – Ali Yaman Jan 12 '20 at 14:35
-
@AliYaman 1m is fine: make sure is does not delete too much. Clone the resulting local repo again to see if the end result looks fine. And `git push --force` of you want to update your remote repository. – VonC Jan 12 '20 at 14:40
-
I tried it and really I research it but i can't push it. Always said that " Either specify the URL from the command-line or configure a remote repository using git remote add
and then push using the remote name git push " ( note : I tried in my branch ) -
@AliYaman Regarding pushing, you just need to add the URL of your existing remote repo (if you are sure the history you have locally is correct), then `git push -f -u origin master` – VonC Jan 12 '20 at 20:30