Conclusion
When GitHub rejects a push because a file exceeds 100MB, you can manage large files using Git LFS (Large File Storage). This allows you to commit and push normally, even when using TortoiseGit.
Where It’s Suitable
- Managing large files with GitHub
- Projects containing large files such as archives, installers, or model files
- Using TortoiseGit for version control
- Encountering GitHub’s 100MB file limit
- Needing to convert existing large files to Git LFS management
Steps
1. Install Git LFS
- Download and install from the Git LFS official website
- After installation, only one-time initialization is required
# 初始化 Git LFSgit lfs installAlthough GitHub supports Git LFS, it must be installed and enabled locally, otherwise large files cannot be tracked properly.
2. Convert Existing Large Files to Git LFS
If there are already files exceeding 100MB in your project, it’s recommended to use the Git LFS Migration feature directly.
# 將所有超過 100MB 的檔案轉換為 LFSgit lfs migrate import--everything--above=100MBThis command scans the entire repository history and converts qualifying large files to Git LFS management, without needing to specify file extensions.
Suitable for:
- Old projects
- Projects where large files have already been committed
- When unsure which files exceed the limit
3. Specify File Extensions for Git LFS
If your project consistently includes large files of specific formats, you can directly set tracking rules.
# 追蹤 7z 檔案git lfs track"*.7z"
# 追蹤 tar.gz 檔案git lfs track"*.tar.gz"After execution, .gitattributes will be automatically updated, and subsequently added files will automatically be stored using Git LFS.
4. Commit and Push with TortoiseGit
Once Git LFS is configured, you can return to TortoiseGit operations.
- Right-click → TortoiseGit → Commit
- Confirm that
.gitattributeshas been added to version control - Commit
- Push to GitHub At this point, large files are actually stored in Git LFS Storage, while the Git Repository only retains pointer files, thus you will no longer encounter GitHub’s 100MB limit.
Additional Notes
Common Errors
| Error Message | Cause |
|---|---|
| File exceeds GitHub’s file size limit of 100 MB | File is not managed by Git LFS |
| Git LFS not installed | Git LFS is not yet installed locally |
| Push rejected | Super large files still exist in the repository’s history |
Practical Recommendations
- For new projects, you can directly set tracking rules for common file extensions
- For old projects, it’s recommended to use
git lfs migrate import - If super large files have already been pushed, you need to rewrite the history before pushing again
Command / Example Summary
Click to expand
# 安裝後初始化git lfs install
# 將所有超過 100MB 檔案轉換為 LFSgit lfs migrate import--everything--above=100MB
# 追蹤指定副檔名git lfs track"*.7z"git lfs track"*.tar.gz"
# 查看目前追蹤規則git lfs track
# 查看 LFS 管理檔案git lfs ls-filesConclusion
GitHub’s 100MB limit doesn’t mean large files cannot be included in version control. By using Git LFS with TortoiseGit, you can manage large files using your usual workflow.