0

I want to hide some files from git adding them to my gitignore from Symfony

Here are the 2 an env file and the doctrine.yaml file because those 2 has personnal data for database connection.

.env
/config/packages/doctrine.yaml

But when I do my git status, I still see those 2 files

git status

modifié :         .env
modifié :         .gitignore
modifié :         composer.lock
modifié :         config/packages/doctrine.yaml
modifié :         symfony.lock

Thanks, I would like to ignore those .lock files too.

Minirock
  • 628
  • 3
  • 13
  • 28

1 Answers1

1

You need to also remove these files from being tracked by the Git repo:

git rm --cached config/packages/doctrine.yaml
git rm --cached composer.lock
# etc. for other files
git push origin your_branch
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360