How to use GIT LFS to track iOS frameworks?

Important: To successfully get Git LFS working, the file may not already be in your Git history.

Mandatory steps:

  1. Install Git LFS via brew (or mac ports.. )

    brew install git-lfs

  2. Initialize LFS inside jour local Git repo. Otherwise your commands will have no effect.

    git lfs install

// Updated pre-push hook. Git LFS initialized.

  1. Do not track the iOS framework directly (eg. “opencv2.framework”) because macOS will treat it as a folder. Just track the one large binary file inside the framework.

    git lfs track MyProject/Libraries/opencv2.framework/Versions/A/opencv2

// Tracking MyProject/Libraries/opencv2.framework/Versions/A/opencv2

  1. Add all the files including the new generated “.gitattributes”

    git add .

  2. Commit changes

    git commit -m "added lfs binary"

  3. Now verify the file is properly tracked by LFS

    git lfs ls-files

// 604bd36eb5 * MyProject/Libraries/opencv2.framework/Versions/A/opencv2

  1. Push the commit and see that Git is uploading the large file first

    git push

// Git LFS: (1 of 1 files) 3.54 MB / 87.34 MB

And you are done.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)