Enable LFS

The following steps should be performed on a freshly generated repository.

Run the following commands to enable LFS for a given repository:

Install LFS

LFS needs to be installed into a repository using this command:

cd <repository>
git lfs install

Enable Tracking by File Extenstion

LFS identifies files to be put in LFS by the file name extension. Run the following command to add the most common extensions for large files that should be placed in LFS:

for ext in 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
do
   git lfs track "*.$ext"
done

If you miss an extension and such files end up in the repository instead of LFS then you can perform the same steps as for converting a repository to LSF and add the missing extension.

Push

Push the changes made by enabling LFS:

git add .gitattributes
git commit -m "add lfs support" .gitattributes
git push

Are these instructions wrong, incomplete or outdated? Are they not helpful?
Please let us know.

Page URL: https://isg.inf.ethz.ch/bin/view/Main/HelpVersionControlGitLabLFSEnable
2019-09-18
© 2019 Eidgenössische Technische Hochschule Zürich