2

In committing and pushing to my repo, I get the following error: enter image description here

The issue is that I've already manually deleted the video file. The video does not exist anywhere in my repo. I also tried to git rm src/assets/video/Greensleeves and it says fatal: pathspec src/assets/video/Greensleeves did not match any files.

How can I get passed this so that I can commit/push?

enter image description here

DeAnna Martinez
  • 389
  • 1
  • 11
  • it must have been added in a previous commit but then deleted in a later one, you'll have to rebase out the commit that has that large file – The Pax Bisonica Oct 09 '20 at 13:13

1 Answers1

0

Try and apply the new git filter-repo, which does replace the old git filter-branch or BFG.

It has many usage examples, including path-based filtering, in order for you to remote the src/assets/video/Greensleeves file in past commits:

To keep all files except these paths, just add --invert-paths:

git filter-repo --path src/assets/video/Greensleeves --invert-paths

Then git push --force (that does rewrite the history of your repository, so make sure to notify any other collaborator)

Since it must be done on a fresh clone:

  1. Don't touch anything to your current clone folder
  2. Create a separate clone of the repository, where you do the filter repo
  3. In that second clone, now cleaned (no more big file in its history), import your work from your first repo

That is, for point 3:

cd /path/to/second/clone
git --work-tree=/path/to/first/original/clone add .
git commit -m "Import work from first clone"
git push --force
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755