How do I resolve 'Large file detected' errors when pushing to GitHub?
GitHub limits file size to 100MB for pushes. To handle large files, consider using Git LFS (Large File Storage) or excluding large files from commits.
The 'Large file detected' error occurs because GitHub enforces a 100MB file size limit for individual files in a repository. If you need to push large files, Git Large File Storage (LFS) is a common solution. First, install Git LFS and track large files with commands like git lfs track '*.psd'
, then add and commit the file as usual. Git LFS stores the file differently, avoiding the 100MB limit. Alternatively, you can exclude large files from your repository by adding them to .gitignore
, which stops Git from tracking them. Another approach is to compress large files or host them externally (e.g., in cloud storage), linking to them in your project instead. Managing large files effectively prevents repository size bloat and keeps your project within GitHub’s file limitations.