git-filter-branch can help you in your case:
Replace PATH-TO-YOUR-CONFIG-FILE with the path to your configuration file that you want to delete, and not just its name.
git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch PATH-TO-YOUR-CONFIG-FILE' \ --prune-empty --tag-name-filter cat -- --all
Add your configuration file to .gitignore to make sure that you didnโt accidentally commit it, complete it and click it, as follows:
echo "YOUR-CONFIG-FILE" >> .gitignore git add .gitignore git commit -m "Add YOUR-CONFIG-FILE to .gitignore" git push origin --force --all
Arpit source share