Fill these in once
- Stop tracking it (the file stays on your disk)
git rm --cached .envFor a whole folder, use git rm -r --cached folder-name. If the file held secrets and was already pushed, change those secrets too.
- Make sure it's in .gitignore
echo ".env" >> .gitignore - Commit the change
git commit -m "Stop tracking .env"
Check it worked
- Check Git now ignores it
git status
- Stop tracking it (the file stays on your disk)
git rm --cached .envFor a whole folder, use git rm -r --cached folder-name. If the file held secrets and was already pushed, change those secrets too.
- Make sure it's in .gitignore
echo ".env" >> .gitignore - Commit the change
git commit -m "Stop tracking .env"
Check it worked
- Check Git now ignores it
git status
- Stop tracking it (the file stays on your disk)
git rm --cached .envFor a whole folder, use git rm -r --cached folder-name. If the file held secrets and was already pushed, change those secrets too.
- Make sure it's in .gitignore
Add-Content .gitignore ".env" - Commit the change
git commit -m "Stop tracking .env"
Check it worked
- Check Git now ignores it
git status