471 字
2 分鐘
瀏覽次數
GitHub Doesn't Accept Files Over 100MB? Solve Large File Commit Issues with Git LFS
2025-07-25
2026-06-01

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
Terminal window
# 初始化 Git LFS
git lfs install

Although 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.

Terminal window
# 將所有超過 100MB 的檔案轉換為 LFS
git lfs migrate import--everything--above=100MB

This 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.

Terminal window
# 追蹤 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 .gitattributes has 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 MessageCause
File exceeds GitHub’s file size limit of 100 MBFile is not managed by Git LFS
Git LFS not installedGit LFS is not yet installed locally
Push rejectedSuper 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 檔案轉換為 LFS
git lfs migrate import--everything--above=100MB
# 追蹤指定副檔名
git lfs track"*.7z"
git lfs track"*.tar.gz"
# 查看目前追蹤規則
git lfs track
# 查看 LFS 管理檔案
git lfs ls-files

Conclusion#

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.

GitHub Doesn't Accept Files Over 100MB? Solve Large File Commit Issues with Git LFS
https://joyceowo.github.io/posts/en/23ba78ea09fa81a49dead618ac617265/
作者
JoyceOwO
發佈於
2025-07-25
許可協議
CC BY-NC-SA 4.0