我已经阅读了其他一些与这个问题相关的线程,每个人似乎只是回到'git reset --hard'...我试图避免,因为我会在错误开始之间失去工作,尝试还原提交,并删除大文件。
Counting objects: 57, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (53/53), done.
Writing objects: 100% (57/57), 74.03 MiB | 447.00 KiB/s, done.
Total 57 (delta 24), reused 0 (delta 0)
remote: Resolving deltas: 100% (24/24), completed with 13 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage
remote: error: Trace: #####
remote: error: See http-git.io/iEPt8g for more information.
remote: error: File large_filename.ext is 104.47 MB; this exceeds GitHub's file size limit of 100.00 MB
To http-PROJECTNAME.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http-PROJECTNAME.git'
$ git rm --cached large_filename.ext
fatal: pathspec 'large_filename.ext' did not match any files
@Edmundo感谢有用的信息让我走到这一步。我想我越来越近了。我创建了一个新的分支,删除了缓存的文件,修改了,然后尝试挑选它,它不会让我合并,因为未跟踪的工作树文件将被覆盖(这很奇怪,因为我以为我删除了它们)。 / p>
$ git branch gj-removehero ###6d9dc0e3983968a012ec22795dd69f7######
$ git checkout gj-removehero
Switched to branch 'gj-removehero'
$ git rm --cache assets/theme/img/hero-ideas/shutterstock_276636890.*
rm 'assets/theme/img/hero-ideas/shutterstock_276636890.jpg'
rm 'assets/theme/img/hero-ideas/shutterstock_276636890.psd'
$ git commit --amend --no-edit
[gj-removehero b7e320b] hero options
Date: Fri Mar 31 09:40:19 2017 -0400
16 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 assets/theme/img/hero-ideas/shutterstock-393187381.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-192138551.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-374766055.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-127556570.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-579102199.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-223736014.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-379532248.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-226122967.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-229092871.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-567904627.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-224715364.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-439437442.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-283528433.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-582564463.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock-528930796.jpg
create mode 100644 assets/theme/img/theme-hero-05.jpg
$ git cherry-pick ###6d9dc0e3983968a012ec22795dd69f7######
error: The following untracked working tree files would be overwritten by merge:
assets/theme/img/hero-ideas/shutterstock_276636890.jpg
assets/theme/img/hero-ideas/shutterstock_276636890.psd
Please move or remove them before you can merge.
Aborting
$ git rm assets/theme/img/hero-ideas/shutterstock_276636890.*
fatal: pathspec 'assets/theme/img/hero-ideas/shutterstock_276636890.jpg' did not match any files
$ git cherry-pick ###6d9dc0e3983968a012ec22795dd69f7######
[gj-removehero 0c808b5] hero options
Date: Fri Mar 31 09:40:19 2017 -0400
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100755 assets/theme/img/hero-ideas/shutterstock_276636890.jpg
create mode 100644 assets/theme/img/hero-ideas/shutterstock_276636890.psd
$ git rm --cache assets/theme/img/hero-ideas/shutterstock_276636890.*
rm 'assets/theme/img/hero-ideas/shutterstock_276636890.jpg'
rm 'assets/theme/img/hero-ideas/shutterstock_276636890.psd'
$ git commit --amend --no-edit
On branch gj-removehero
Untracked files:
assets/theme/img/hero-ideas/shutterstock_276636890.jpg
assets/theme/img/hero-ideas/shutterstock_276636890.psd
No changes
You asked to amend the most recent commit, but doing so would make
it empty. You can repeat your command with --allow-empty, or you can
remove the commit entirely with "git reset HEAD^".