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
  • 404
  • 6
  • 17
  • 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,262,500
  • 529
  • 4,410
  • 5,250
  • I added another screenshot with the console message from ```git filter-repo``` – DeAnna Oct 09 '20 at 12:38
  • @DeAnnaMartinez OK: do it on a fresh clone of your repository. – VonC Oct 09 '20 at 12:41
  • I have added so much to my repo but haven't been able to commit in over a week, so if I clone, it will be missing code and then I can just copy/paste in my new code? – DeAnna Oct 09 '20 at 12:43
  • @DeAnnaMartinez I have edited my answer to address your comment/question. – VonC Oct 09 '20 at 13:11