1. 로컬에서 삭제

git filter-branch --force --index-filter "git rm --cached --ignore-unmatch 특정파일명" --prune-empty --tag-name-filter cat -- --all

// 예시
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch .env.prod" --prune-empty --tag-name-filter cat -- --all

 

2. 원격저장소 동기화

git push origin --force --all