包含大文件的git push文件夹

时间:2014-05-13 07:31:12

标签: git push ignore

在我的git存储库中,我有一个文件夹(DATA),其中包含包含大文件的其他文件夹。 我使用以下文本

创建了一个.gitignore文件
DATA/

我尝试更新我的存储库中的文件,但无论如何我都遇到了这个错误

remote: warning: File DATA/segmentation/Feat_2.mat is 94.46 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: warning: File DATA/segmentation/Feat_3.mat is 61.77 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: warning: File DATA/segmentation/Feat_4.mat is 80.35 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: warning: File DATA/segmentation/Feat_5.mat is 85.85 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: warning: File DATA/segmentation/Feat_6.mat is 78.94 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: warning: File DATA/segmentation/Feat_7.mat is 66.61 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: error: GH001: Large files detected.
remote: error: Trace: 66ef415089784516b0d76ac2e639a7ac
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File DATA/segmentation/Feat_1.mat is 123.29 MB; this exceeds GitHub's file size limit of 100 MB
To https://github.com/gabboshow/smartscope_code.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/gabboshow/smartscope_code.git'
gabbo@gabbo-SATELLITE-L750:/media/Data/Condiviso/TUe/Smartscope_study/smartscope_code$ 

如何修复git push并继续提交我的文件而忽略文件夹DATA中的所有文件?

1 个答案:

答案 0 :(得分:1)

您似乎已在DATA中提交了文件,然后将其添加到.gitignore,不是吗?

忽略已提交的文件是Git常见问题解答。简短的回答是:

.gitignore仅适用于未跟踪的文件,即从未提交过的文件(甚至是git add)。

参见例如: Applying .gitignore to committed files

您必须从存储库中删除大文件才能推送。请注意,您也必须从历史记录中删除它们(通过重写历史记录);在新提交中删除它们是不够的。

Github有一个很好的页面,如何执行此操作,链接在您的错误消息中: https://help.github.com/articles/working-with-large-files