I commited and pushed binary file to git repo. Actually I don't wan't this file in git repo, I was needed to add it to LFS.
So, firstly question is - how to exclude this file from remote git tracking?
Add it to your .gitignore file and don't forget to commit the file :-)
.gitignore for you and add the required path to your binary files/folder(s)Once you added the file to .gitignore you can remove the "old" binary file with BFG.
Since the file is already tracked by git, unless you will remove it from history (ex. BFG) you need to remove it manually and commit your changes.
How to remove big files from the repositoryYou can use git filter-branch or BFG.
https://rtyley.github.io/bfg-repo-cleaner/
BFG Repo-Cleaneran alternative to git-filter-branch.
The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:
* Removing Crazy Big Files*
* Removing Passwords, Credentials & other Private data
In all these examples bfg is an alias for java -jar bfg.jar.
# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa} my-repo.git