Git-LFS

From Bonus Bits
Jump to: navigation, search

Description

This article gives common command example for using the Github Git Large File System or LFS add-on. Github.com supports this LFS sub-filesystem. So you can push binaries in your projects to GitHub using this add-on and the binaries will be stored in their LFS sub-system.


Prerequisites


Track Binaries in Project

You have to specify which files or file types to track with LFS. Either manually edit the .gitmodules file or use the following command example and it will create/update the .gitmodules file for you.

git lfs track "*.tgz"
git lfs track "*.rpm"
git lfs track "*.jar"


Add & Commit

Example from root of project:

git add .gitattributes
git add path/if/not/root/packagename.rpm
git commit -m "add rpm"


List Tracked LFS Files

Github.com or if have setup on an internal Github Enterprise.

git lfs ls-files


Push to Github

Github.com or if have setup on an internal Github Enterprise.

git push origin master


Download LFS File/s Locally

  1. First Clone the repository locally
  2. Then from the root of the cloned repo where there is a .gitmodules file use the following command to download the binaries.
    git lfs pull
    


Related Articles


Sources