【发布时间】:2017-06-04 11:12:36
【问题描述】:
没有真正考虑,我一直在提交我在开发中使用的图像,然后将其推送到我的 Github 存储库。
在发现这导致我无法将项目推送到我的分支后,我搜索了一种解决方案来从我的存储库中删除这些图像,然后将这些图像添加到我的 gitignore 文件中。
我找到了几个解决方案:StackOverflow、this blog、git 和其他一些解决方案。他们似乎都在以同样的方式推动我:
git rm --cached -r /public/uploads/image/file/**
我已经运行了该代码的一些变体,例如删除 **、file/**、--cached 和 image/file/**,但这并没有改变我仍然可以在我的GitHub 分支。
我也将此添加到我的 gitignore 文件中:/public/uploads/image/file/**
但是当我推送到存储库分支时,我得到了这个信息,告诉我为什么我不能推送到 Github:
我从git add . 开始了解上下文。
ruby 2.3.3-p222
╳ project_name categories ◆ git add .
ruby 2.3.3-p222
╳ project_name categories ◆ git commit -m "trying to get a commit in after purging development environment image data"
[categories 8c13b0a] trying to get a commit in after purging development environment image data
1 file changed, 1 insertion(+), 3 deletions(-)
ruby 2.3.3-p222
╳ project_name categories git push origin categories
Counting objects: 3840, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3664/3664), done.
Writing objects: 100% (3672/3672), 163.83 MiB | 3.98 MiB/s, done.
Total 3672 (delta 1242), reused 0 (delta 0)
remote: Resolving deltas: 100% (1242/1242), completed with 57 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 85ba931580b369a222fcf5903416f84e
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File public/uploads/image/file/30/show_55MiEk4_-_Imgur.gif is 119.49 MB; this exceeds GitHub's file size limit of 100.00 MB
To git@github.com:Lenocam/project_name.git
! [remote rejected] categories -> categories (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:Lenocam/project_name.git'
所以,现在我很困惑,因为没有将/public/uploads/image/file/** 添加到我的 gitignore 文件中告诉 git 忽略文件夹和其中的文件?为什么文件会继续推送到我的存储库?
在我看来,我已经要求 git/Github 删除那些旧文件(通过终端命令)并完全忘记它们曾经存在过,因此他们将不再向我询问它们(通过 gitignore)。
我假设我做错了事或做错了事。您能给我的任何帮助将不胜感激。
【问题讨论】:
标签: ruby-on-rails git github gitignore delete-file