Git provides a native way to remove a file from the entire commit history
Make sure you backup your repository before attempting this.
Use the git filter-branch command to remove the file from all commits in your repository history.
Replace <file_path> with the actual file path and name from the root of your project:
git filter-branch --force --tree-filter 'rm -f <file_path>' --prune-empty -- --all
Run Git's garbage collection to clean up unnecessary objects:
git reflog expire --expire=now --all && git gc --prune=now --aggressive