bozaro / git-lfs-migrate

Simple project for convert old repository for using git-lfs feature
MIT License
222 stars 29 forks source link

Repo size increased from 2 to 9 Gig #42

Open stalebbeik opened 7 years ago

stalebbeik commented 7 years ago

I am using the following versions: Centos 6.5 git 2.0.5 git-lfs-migrate 0.2.5

I am trying to prepare a repository that is in Gerrit which has eight large files over 100 MB. So in order to migrate and push it to Github with LFS support, I used git-lfs-migrate. I noticed that the size of the converted repository has increased from 2 to 9 Gig. There is a new "lfs" subdirectory with 2 GB and "objects" subdirectory has increased from 2 to 7.4 Gig. Does anyone have an idea what might be the issue? Here are my commands:

$ git clone --mirror ssh://username@gerrit/repo.git $ java -jar /home/user/git-lfs-migrate.jar -s repo.git -d repo-converted.git ".csv" ".xls" "*.rtf" $ cd repo-converted.git $ git fsck

Also, I noticed that all the commits in the converted repository have a new hash. I am guessing that this is an expected behavior.

cosimo-dw commented 7 years ago

I also faced similar problems. And here are what I found online:

  1. the "objects" subdirectory after the migration is in loose object format (i.e. uncompressed). git will compress them on push before uploading files, or you can use "git gc" to manually pack them, after which you will see a huge decrease of repo size.
  2. hashes of commits are all based on files. And since large files are all changed from blob to pointers new hash is expected.
stalebbeik commented 7 years ago

Thanks for the response. Is this the specific git command that you suggest to run? git gc --prune=now --aggressive

cosimo-dw commented 7 years ago

I didn't try with --aggressive nor --prune=now, which are probably up to your choice.