我尝试在我的应用程序中提交一些更改,并收到错误,开发日志太大,为512MB。我删除了开发日志文件并再次尝试,同样的错误显示日志大小为103.2MB。我也尝试rake log:clear
同样的错误。
显然,开发日志文件正在被重写。我从来没有使用过日志,可能不会错过它们...有没有办法提交git而不是重写开发日志?
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
尝试以下答案1和2的建议后更新:
问题仍然存在。我已经从git repo和我的本地机器中删除了日志文件,插入了.gitignore文件并使用config logger位更新了development.rb。下面的最后两行显示在git或我的本地计算机中不存在development.log文件。
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:
更新
我之前的提交仍然有log / development.log文件。使用下面所选答案提供的代码(非常感谢这个人),问题是通过一个小警告解决的:
git filter-branch --index-filter 'git rm --cached --ignore-unmatch log/development.log' --tag-name-filter cat -- --all
需要注意的是,我必须使用git push origin +master
来覆盖git自动拒绝非快进更新。我很乐意这样做,因为我是唯一一个在这个应用程序上工作的人。看到这个问题:
答案 0 :(得分:7)
好像您之前已将development.log
文件添加/签入git仓库。
您需要将其删除,然后进行提交。
git rm log/development.log
git commit -m "removed log file"
通常,您应该将日志目录放入.gitignore文件
echo log >> .gitignore
并完全删除所有日志文件(如果已添加其他文件)
git rm -r --cached log
git commit -m "removed log file"
Github最近开始对最大文件大小实施100MB限制。 https://help.github.com/articles/working-with-large-files
编辑:
看来你之前的提交没有被推送到本地的github。
尝试运行
git filter-branch --index-filter 'git rm --cached --ignore-unmatch log/development.log' --tag-name-filter cat -- --all
答案 1 :(得分:3)
防止文件在您自己的磁盘上展开的答案,只需在STDOUT
中登录development.rb
:
config.logger = Logger.new(STDOUT)
您将在服务器页面上保留日志,但不会再填充该文件。