包含大文件的Git推送文件夹



在我的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中的所有文件?

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

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

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

参见如下示例:将.gitignore应用于提交的文件

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

Github有一个关于如何做到这一点的好页面,链接在你的错误信息中:https://help.github.com/articles/working-with-large-files

最新更新