2013-09-29 24 views
6

我试图在我的应用程序中提交一些更改,并收到开发日志在512MB时太大的错误。我删除了开发日志文件并再次尝试,同样的错误出现了,日志大小为103.2MB。我也试过​​,发生同样的错误。开发日志文件超过GitHub的文件大小限制,甚至在删除文件后

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

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 

更新和低于2:

的问题依然存在。我已经从git仓库中删除了日志文件,并且在本地机器上插入了.gitignore文件,并使用配置记录器位更新了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: 

UPDATE

我早些时候曾承诺仍然有日志/ 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-fast-forward rejected

回答

7

看来你刚才添加/签入您的development.log文件到混帐回购协议。

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

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

+1,这是要做的事情摆脱你的回购中的文件,考虑检查我的答案停止,以避免这个文件被填充 – apneadiving

+0

非常感谢您的答复。我尝试了所有这些,但仍然得到相同的错误。任何其他想法? – tbone

+0

@tbone检查此链接http://stackoverflow.com/questions/17382375/github-file-size-limit-changed-6-18-13-cant-push-now/17415982#17415982 –

3

侧回答,以防止文件扩展自己的硬盘上,只需登录到STDOUTdevelopment.rb

config.logger = Logger.new(STDOUT) 

你会保留日志服务器页面上,但该文件不会再被填充。

+0

感谢您的建议,非常感谢。 – tbone

+0

我在启动rails服务器时没有将日志打印到标准输出的<另一个环境>有问题。将该行放入<另一个环境> .rb中会有所帮助。谢谢。 但日志在日志文件和标准输出。我不介意,但想指出。使用导轨5 –