Google Maps SDK Exceeds GitHub's File Size Limit

At Modeo we're big fans of Google's mapping APIs. Since we are developing biking apps, mapping and location tech plays a big role in our day-to-day work.  So when I updated to Google Maps SDK 1.11.1 and received this error my day ground to a halt:

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 3509bacf08db7e7c09ceb60d27baaac8
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File Pods/GoogleMaps/Frameworks/GoogleMaps.framework/Versions/A/GoogleMaps is 113.56 MB; this exceeds GitHub's file size limit of 100.00 MB

Fortunately, the error message offers a useful way of solving the problem without rolling back to an earlier version of the GoogleMaps SDK: Git Large File Storage.

What's that? Git Large File Storage (LFS) is an open source extension for Git that allows you to add files over 100mb to your Git repository. It works by "replacing large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server". In other words, it keeps the big files out of your repo and stores them elsewhere.

Git LFS is super convenient and easy to use. All you need to do is add a file to be tracked by LFS and the rest of your workflow remains the same.

Install Git LFS

$ install git lfs
git lfs initialized
  1. Download Git LFS
  2. Locate the downloaded file on your computer. 
  3. Unzip the file and double click "install.sh" .
  4. Verify that the installation was successful by opening terminal (or Git Bash) and running the command "git lfs install". You should see "git lfs initialized" print out in the terminal.
  5. If you're working on a team then you'll need Git LFS installed as part of every teammate's dev environment.

Configure Your Repo

$ git lfs track Pods/GoogleMaps/Frameworks/GoogleMaps.framework/Versions/A/GoogleMaps
  1. Open a terminal or Git bash window in the directory of your Git repo.  
  2. Since we're only interested in tracking this one large file we'll use the command "git lfs track" with a reference to the path of the library file. From your project root directory this should be "Pods/GoogleMaps/Frameworks/GoogleMaps.framework/Versions/A/GoogleMaps".
  3. Commit your changes and push to Git.
  4. Breath a sigh of relief.

Keep in mind that Git LFS will incur additional charges if you store more than 1GB of files or exceed more than 1GB of bandwidth in a given month. Since the file in question is 113MB we are well below the limit. But keep in mind that a team of 10 people all pulling down this 113MB file in the same month would exceed the bandwidth limit. Fortunately every additional 50GB of storage and bandwidth is only $5 on GitHub.

And now for a cool bike...