Quick guidance
What belongs in .gitignore?
Ignore generated dependencies, build output, local editor state, operating-system metadata, and environment files. Do not use .gitignore to hide a secret that was already committed: remove it from history when necessary and rotate the credential.
Tracked files are not affected
Adding a pattern does not untrack files already in Git. Inspect with git status, then use git rm --cached <path> only for the exact file you intend to stop tracking.