-1

I would like to ignore a file named .env.local file so it's not committed, because I have some local parameters in it and my team workers have their own local parameters in it. So we want only .env to be commited.

But the .env.local file can not be ignored by my .gitignore file :

/.env.local.php
/.env.local
/.env.*.local

while any other files in .gitignore file is correctly ignored.

yivi
  • 42,438
  • 18
  • 116
  • 138
Farnoosh
  • 11
  • 1
  • Well that seems quite mysterious. Are you positive you are looking at the correct .gitignore file? – Cerad Sep 02 '21 at 16:33
  • 5
    If the file is already tracked, listing it in `.gitignore` will have no effect. Is the file already tracked? (The output of `git ls-files --stage .env.local` will tell you.) – torek Sep 02 '21 at 17:01
  • 3
    This might help https://stackoverflow.com/questions/1274057/how-can-i-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitign – joanis Sep 02 '21 at 18:07

1 Answers1

1

Thank you @joanis @torek,

As you showed, this command fixed my probleme :

git rm --cached .env.local

Farnoosh
  • 11
  • 1