Answer Execute this code in your repository git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch .env' \ --prune-empty --tag-name-filter cat -- --all don't forget to replace .env by expected name.
My .env file still shows in the commit on GitHub after running above code.