Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Development Log file exceeds GitHub's file size limit, even after deleting file

I tried to commit some changes in my app, and received an error that the development log was too big at 512MB. I deleted the development log file and tried again, and the same error showed up with a log size of 103.2MB. I also tried rake log:clear with the same error.

Apparently the development log file is getting rewritten. I have never used the logs and would probably not miss them...is there a way to commit to git and not rewrite the development log?

 2 files changed, 0 insertions(+), 1096498 deletions(-)
 rewrite log/development.log (100%)
 rewrite log/production.log (100%)
[master]~/Projects/schoolsapi: git push origin master
Username: 
Password: 
Counting objects: 26, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (17/17), 6.90 MiB | 322 KiB/s, done.
Total 17 (delta 7), reused 0 (delta 0)
remote: Error code: 026c4e06d174bf5b0e51c754dc9459b0
remote: warning: Error GH413: Large files detected.
remote: warning: See http://git.io/iEPt8g for more information.
remote: error: File log/development.log is 103.32 MB; this exceeds GitHub's file size limit of 100 MB

Update after trying suggestions from answers 1 and 2 below:

The problem still exists. I've removed the log file from the git repo, and my local machine, inserted the .gitignore file and updated development.rb with the config logger bit. The last two lines below show that the development.log file does not exist in git or my local machine.

master]~/Projects/schoolsapi: git add .
[master]~/Projects/schoolsapi: git commit -m"Tried config logger per apnea diving"
[master b83b259] Tried config logger per apnea diving
 2 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
[master]~/Projects/schoolsapi: git push origin master
Username: 
Password: 
Counting objects: 38, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (26/26), 6.90 MiB | 525 KiB/s, done.
Total 26 (delta 12), reused 0 (delta 0)
remote: Error code: e69d138ee720f7bcb8112e0e7ec03470
remote: warning: Error GH413: Large files detected.
remote: warning: See http://git.io/iEPt8g for more information.
remote: error: File log/development.log is 103.32 MB; this exceeds GitHub's file size limit of 100 MB
[master]~/Projects/schoolsapi: rm log/development.log
rm: log/development.log: No such file or directory
[master]~/Projects/schoolsapi: git rm log/development.log
fatal: pathspec 'log/development.log' did not match any files
[master]~/Projects/schoolsapi: 

UPDATE

I had earlier commits which still had the log/development.log file. Using this code provided by the selected answer below (huge thanks to this person), the problem was fixed with one small caveat:

git filter-branch --index-filter 'git rm --cached --ignore-unmatch log/development.log' --tag-name-filter cat -- --all

The caveat is that I had to use git push origin +master to override git's automatic rejection of non-fast-forward-updates. I was comfortable doing this because I am the only person working on this app. See this question:

Git non-fast-forward rejected

like image 545
tomb Avatar asked Sep 29 '13 20:09

tomb


1 Answers

It seems you have earlier added/checked-in your development.log file into the git repo.

You need to remove it, and make a commit.

git rm log/development.log
git commit -m "removed log file"

In general, you should put your log directory into your .gitignore file

echo log >> .gitignore

And to completely remove all the log files (in case others were added)

git rm -r --cached log
git commit -m "removed log file"

Github has recently started enforcing a 100MB limit for maximum file sizes. https://help.github.com/articles/working-with-large-files

Edit:

It seems you have previous commits which weren't pushed to github locally.

Try running

git filter-branch --index-filter 'git rm --cached --ignore-unmatch log/development.log' --tag-name-filter cat -- --all
like image 64
Anshul Goyal Avatar answered Sep 30 '22 17:09

Anshul Goyal