
Attempting to push a large file to github via `git push` may trigger an error similar to the following:
remote: error: Trace: a7fd45f56d86a2746c59141ab1ba4d49244652a35cf9b13527478e82b90a5ec3 remote: error: See http://git.io/iEPt8g for more information. remote: error: File <your-file> is 217.39 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. To github.com:<your-repo> ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'github.com:
Here's how to fix it, but beware, as of this writing:
- Downloads count against your personal bandwidth limit, 1 GB/month
- Without LFS, files are limited to 100GB, or 25GB through the browser
- Large files count against repo size limit.
- Other options: look at releases, or other external file server solutions
The fix:
Step 1. If you already commited the large file, you'll want to undo the commit:
git rm --cached <your-large> git commit --amend -CHEAD --allow-empty
Step 2. If you're on ubuntu, here are the commands to retrieve git lfs:
sudo apt-get update -y sudo apt-get install -y git-lfs
To install on other platforms, see: https://github.com/git-lfs/git-lfs/releases/tag/v3.2.0
Step 3. Install
git lfs install
Step 4. Track your large files
# for large model files, use: git lfs track "*.h5" # .gitattributes will have been modified, track that too: git add .gitattributes
Step 5. Add your large file, e.g.
git add model.h5 git commit -c "added big model file" git push origin main
Other Resources:
- https://git-lfs.github.com/