Large File Storage (LFS) in GIT
Updated 135 Days AgoPublic

Phabricator supports GIT LFS for large file storage outside of the git index.
Only a reference to the file is stored in git tracking the changes, the file itself is stored in phabricator's storage.

WARNING: Do not store huge files (>1GB) in LFS as we have limited capacity, for data you should use your local university storage service.

Installation

Usage

  • In an existing git repository, initialize lfs and start tracking files,
git lfs install
git lfs track bigfile.bin
git lfs track *.png
# etc
  • Add the file to git, commit and push
git add bigfile.bin
git add myimage.png
git add .gitattributes
git commit -m "Added a bigfile using LFS"
git push origin master
  • You can also track a pattern of files, so every new file matching this pattern will be added using lfs:
git lfs track *.png
  • Voila!

Convert already commited files to Git LFS

WARNING: This will rewrite your history and will then impact all people working on your repository
find -type f -exec ls -lh {} \; | awk '{print $5,$9}' | sort -h
  • Go to your git repository directory and use bfg with the extensions you found
java -jar bfg.jar --convert-to-git-lfs '*.{wav,pdf,avi}'
  • Inspect your history to see the changes and clean dirty data to complete the procedure
git reflog expire --expire=now --all && git gc --prune=now --aggressive
  • Activate Dangereous Changes from the repository configuration: ActionsManage RepositoryBasicsActionsAllow Dangerous Changes

  • Push the repository back to c4science
IMPORTANT: it's dangerous and will destroy your old history, have a local backup of this!
git push --force
  • Deactivate Dangerous Changes (same as before)
Last Author
aubort
Projects
Subscribers
None