0

I was copying some files in my folder and by mistakenly I added 169.57MB zip file and because of not knowing about the zip file I run git command git add . and git commit -m "new feature added" and finally git push origin bugSolver-214

and when the process was running I saw zip file and terminated the process in middle by doing ctrl + c and delete the zip file and again done above steps git add . git commit -m "new feature added" git push origin bugSolver-214

I saw this msg

remote: error: Trace: cf3cf1a67efcc5bc0461f8937f71d0f505487379cc1a3c870b480c7cf60126a7
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File admin config.zip is 169.57 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

As I already removed the permanently zip file I can't see how I can remove admin config.zip file

So I made some changes in my code and tried to commit again but it still showing me same issue

I searched internet created new branch but same error even tried git reset . but no help

even tried this to git rm --cached "admin config.zip"

fatal: pathspec 'admin config.zip' did not match any files

is there any way I can remove that admin config.zip file and commit my code again

  • https://stackoverflow.com/q/2100907/7976758 Found in https://stackoverflow.com/search?q=%5Bgit%5D+remove+large+file+history – phd Apr 23 '22 at 20:13

1 Answers1

0

One option, for getting rid of large files in past commits, is to use git filter-repo (python-based, to be installed first)

And use some content-based filtering:

If you want to filter out all files bigger than a certain size, you can use --strip-blobs-bigger-than with some size (K, M, and G suffixes are recognized), e.g.:

git filter-repo --strip-blobs-bigger-than 100M

Then a git push --force will update your branch (which is fine if you are the only one working on it)


In your case though, if this was done recently (just in the last commit), you could:

git reset --soft @~1
echo "*.zip">> .gitignore
git add .
git commit -m "re-add everything except zip files"
git push --force
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi @VonC I tried your command but it still showing me same issue –  Apr 23 '22 at 19:37
  • @Vikas Which command? The second one assumes your last commit is the one where the zip was added. – VonC Apr 23 '22 at 19:40
  • I don't know how many time I tried `git add .` command now what should I do ? –  Apr 23 '22 at 19:43
  • @Vikas First make sure in which commit your zip file was added. The last one? – VonC Apr 23 '22 at 19:46
  • I think maybe the last 5-6th one I am not sure –  Apr 23 '22 at 19:48
  • @Vikas OK, then I recommend the first option: `git filter-repo` will get rid of that file for you, wherever it is. – VonC Apr 23 '22 at 19:50
  • so how to use `git filter-repo` ? I just run this command ? –  Apr 23 '22 at 19:51
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/244136/discussion-between-vonc-and-vikas). – VonC Apr 23 '22 at 19:52