1

I uploaded a file(a huge fool file) accidentally to my git repository, when I noticed it I "removed" using git rm the_fool_file

Then I saw that the file is still at the repository althought it was removed from my local.

How can I removed from the server and definitely delete it?

Thanks in advance.

I also tried

git filter-branch --tree-filter 'rm -f myfile' HEAD

got

WARNING: Ref 'refs/heads/master' is unchanged

file is not at head, it was removed

Andres
  • 4,323
  • 7
  • 39
  • 53

1 Answers1

3

The OP Andres mentions in the comments:

I want to remove it because it is huge and does not belong to the project, it was uploaded accidentally

Then the easiest way to do that is by using BFG Repo-Cleaner

Remove all blobs bigger than 1 megabyte :

$ bfg --strip-blobs-bigger-than 1M  my-repo.git

That will take care of all the commits before the current one.

But don't forget to then run:

git gc --prune=now --aggressive

(as detailed in "Git repo still huge after large files removed from repository history")

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250