How to handle large files (Chromium, GeckoView) with Git

There are two 3D WebView packages that include large files:

These libraries are large because they contain the entire browser engine used by 3D WebView (Chromium and Gecko). GitHub has a maximum file size of 100 MB, so if you commit one of these files to your git repo and then try to push it to GitHub, you'll receive an error like this in the terminal:

> git push
...
remote: error: File libcef.dll is 160.55 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
...
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'github.com:example_account/example_repo.git'

If you encounter this issue, there are several options to resolve it:

  1. The first option is to use Git Large File Storage (LFS) to store the files. For example, after you install Git LFS, you can track 3D WebView's large files like this:
# Track each of the large files listed above.
git lfs track "libcef.dll"
git lfs track "libcef*.dll"
git lfs track "Chromium Embedded Framework"
git lfs track "geckoview*.aar"
  1. Another option is to switch from GitHub to a different Git hosting site with a larger max file size. For example, Bitbucket's max file size is 1 GB.

  2. A third option is to add the large files to your project's .gitignore file to prevent Git from tracking them at all. The downside to this approach is that it prevents Git from saving the files, so if you clone the repo or checkout an old commit, you'll have to update the large files manually.