Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paul-vd/604b87a2f502ce1a039c8bf52807298f to your computer and use it in GitHub Desktop.
Save paul-vd/604b87a2f502ce1a039c8bf52807298f to your computer and use it in GitHub Desktop.
remove env file from git history
echo '.env' >> .gitignore
git rm -r --cached .env
git add .gitignore
git commit -m 'untracking .env'
git push origin master
@paul-vd
Copy link
Author

paul-vd commented Jan 18, 2021

remove from history:

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch .env" HEAD
git push --force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment