开发日志文件即使在删除文件后也会超出GitHub的文件大小限制 [英] Development Log file exceeds GitHub's file size limit, even after deleting file

查看:174
本文介绍了开发日志文件即使在删除文件后也会超出GitHub的文件大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的应用程序中进行一些更改,并收到一个错误,说明开发日志在512MB时太大。我删除了开发日志文件并再次尝试,同样的错误出现了,日志大小为103.2MB。我也尝试了 rake log:clear ,它有相同的错误。



显然开发日志文件正在被重写。我从来没有使用日志,并可能不会错过他们...有没有办法承诺git,而不是重写开发日志?

  2个文件已更改,0个插入(+),1096498删除( - )
重写log / development.log 100%)
重写日志/ production.log(100%)
[master]〜/ Projects / schoolsapi:git push origin master
用户名:
密码:
计数对象:26,完成。
使用多达2个线程的增量压缩。
压缩对象:100%(15/15),完成。
写作对象:100%(17/17),6.90 MiB | 322 KiB / s,完成。
总计17(delta 7),重用0(delta 0)
remote:错误代码:026c4e06d174bf5b0e51c754dc9459b0
remote:警告:错误GH413:检测到大文件。
remote:警告:有关更多信息,请参阅http://git.io/iEPt8g。
remote:error:文件日志/ development.log为103.32 MB;这超过了GitHub的文件大小限制为100 MB

在尝试下面答案1和2的建议后更新:



问题依然存在。我已经从git repo中删除了日志文件,并且在本地机器上插入了.gitignore文件,并使用配置记录器位更新了development.rb。下面的最后两行显示了在git或我的本地机器中不存在development.log文件。

  master]〜/ Projects / schoolsapi:git add。 
[master]〜/ Projects / schoolsapi:git commit -m每次呼吸暂停时尝试配置记录器
[master b83b259]每次呼吸暂停尝试配置记录器
更改2个文件,4次插入+),0删除( - )
创建模式100644 .gitignore
[master]〜/ Projects / schoolsapi:git push origin master
用户名:
密码:
计数对象:38,完成。
使用多达2个线程的增量压缩。
压缩对象:100%(23/23),完成。
写作对象:100%(26/26),6.90 MiB | 525 KiB / s,完成。
总计26(delta 12),重用0(delta 0)
remote:错误代码:e69d138ee720f7bcb8112e0e7ec03470
remote:警告:错误GH413:检测到大文件。
remote:警告:有关更多信息,请参阅http://git.io/iEPt8g。
remote:error:文件日志/ development.log为103.32 MB;这超过了GitHub的文件大小限制为100 MB
[master]〜/ Projects / schoolsapi:rm log / development.log
rm:log / development.log:没有这样的文件或目录
[ master]〜/ Projects / schoolsapi:git rm log / development.log
fatal:pathspec'log / development.log'与任何文件不匹配
[master]〜/ Projects / schoolsapi:

更新



我之前提交过的还有日志/ 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自动拒绝非快进更新。我很喜欢这样做,因为我是唯一一个在这个应用上工作的人。看到这个问题:



Git non-快进拒绝

解决方案

看来您之前已添加/签入您的



您需要将其删除并进行提交。

  git rm log / development.log 
git commit -m删除的日志文件

一般而言,您应该将您的日志目录放入您的.gitignore文件中。

  echo log>> .gitignore 

完全删除所有日志文件(如果添加了其他文件)

  git rm -r --cached log 
git commit -m删除的日志文件

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 


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

解决方案

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

这篇关于开发日志文件即使在删除文件后也会超出GitHub的文件大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆