如何从本地存储库中删除大文件以成功推送

时间:2014-10-15 10:26:57

标签: linux git file github

我刚刚创建了本地存储库并提交了根目录中的所有文件。 但GiutHub未能推动远程集线器导致巨大文件限制:

[srv50213@cl10-m htdocs]$ git push -u origin master
Counting objects: 17875, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (17645/17645), done.
Writing objects: 100% (17875/17875), 413.33 MiB | 3.69 MiB/s, done.
Total 17875 (delta 5496), reused 0 (delta 0)
remote: warning: File 20140924.srv50213_tarex.dump is 82.14 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: error: GH001: Large files detected.
remote: error: Trace: ac437f9f600e8418e6bf5065e472204c
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File htdocs/2014-10-09-10:40-site-archive.zip is 227.12 MB; th exceeds GitHub's file size limit of 100 MB
To git@github.com:igorsavinkin/tarex.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:igorsavinkin/tarex.git'

之后我尝试从本地仓库中删除这些文件但失败了,根据instruction

[srv50213@cl10-m htdocs]$ git rm --cached 20140924.srv50213_tarex.dump
fatal: pathspec 'htdocs/20140924.srv50213_tarex.dump' did not match any files

[srv50213@cl10-m ~]$ git rm --cached 20140924.srv50213_tarex.dump
rm '20140924.srv50213_tarex.dump'

[srv50213@cl10-m ~]$ git rm --cached htdocs/2014-10-09-10:40-site-archive.zip
fatal: pathspec 'htdocs/2014-10-09-10:40-site-archive.zip' did not match any files
[srv50213@cl10-m ~]$ git rm --cached 2014-10-09-10:40-site-archive.zip
fatal: pathspec '2014-10-09-10:40-site-archive.zip' did not match any files

即使我修改了:

[srv50213@cl10-m ~]$ git commit --amend -CHEAD
[master 35dc27d] remove file1.txt
6 files changed, 1249 insertions(+), 2072 deletions(-)
delete mode 100644 20140924.srv50213_tarex.dump
delete mode 100644 20140924.srv50213_yupe.dump
delete mode 100644 htdocs/2014-10-09-10:40-site-archive.zip

当我想再推它时,我得到了相同的结果:

[srv50213@cl10-m ~]$ git push -u origin master
Counting objects: 17875, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (17645/17645), done.
Writing objects: 100% (17875/17875), 413.33 MiB | 3.63 MiB/s, done.
Total 17875 (delta 5499), reused 0 (delta 0)
remote: warning: File 20140924.srv50213_tarex.dump is 82.14 MB; this is larger than GitHub's recommended maximum file size of 50 MB
remote: error: GH001: Large files detected.
remote: error: Trace: 7abab285207c27988ceddd39f61f25cd
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File htdocs/2014-10-09-10:40-site-archive.zip is 227.12 MB; this exceeds GitHub's file size limit of 100 MB
To git@github.com:igorsavinkin/tarex.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:igorsavinkin/tarex.git'

如何使用存储/卡在本地仓库中的2个大文件解决此任务? 当我想通过git rm --cached 2014-10-09-10:40-site-archive.zip将它们从git中删除时,它的实例应该在工作副本的相应文件夹中吗?

0 个答案:

没有答案