Convert to LFS
For repositories that have reached the
limit it is necessary to move large files already in the repository to LFS. Simply deleting files is not enough as these are still present in previous revisions.
A script that uses BFG
to move files to LFS is available from isginf
git clone firstname.lastname@example.org:SHARED-ISG/convert-to-git-lfs.git
The usage of the tool is as follows:
Usage => convert-to-git-lfs [optional arguments] repository_url
-u bfg-jar download url => -u 'http://repo1.maven.org/maven2/com/madgag/bfg/1.12.13/bfg-1.12.13.jar'
-b bfg-jar download target => -j './bfg-1.12.13.jar'
-t lfs track file extensions => -t 'bin,exe,jar,dmg,pkg,apk,deb,rpm,msi,msu,zip,rar,7z,tar,tar.gz,tgz,gz,bz2,xz,cab,mp4,m4v,mkv,flv,wmv,ogv,avi,mov,mp3,m4a,m4r,au,ogg,wav,wma,raw,iso,img'
-j java runtime binary => -j 'java'
-d working directory => -d '/local/convert-to-git-lfs'
-h show this help
The default work directory is
. On systems not managed by isginf
you will probably need to change this.
Before You Begin
Make sure nobody is interacting with the repository and that all changes are committed. There is not way to enforce this on GitLab so you need to communicate this to everybody who can make changes.
Also, make an additional backup of the repository as it was before the conversion using this command:
git clone --mirror email@example.com:<group>/<project>.git /some/path/<project>.git.backup-before-lfs'
with the URL of the repository:
When done you will need to push the changes back:
git --git-dir='/local/convert-to-git-lfs/project-name.git' push
Execute the Housekeeping
in the GitLab project settings.
After You Finish
If the project did not have LFS already enabled then every project member must remove the old local repository and clone a fresh copy with LFS support