A .gitignore file lists patterns of files and folders that Git should not track. Put it in the repository root.
Usually ignored:
Build output:bin/, obj/, dist/, build/
Dependencies:node_modules/, packages/, .venv/
IDE and OS files:.vs/, .idea/, .DS_Store, Thumbs.db
Logs and temporary files:*.log, *.tmp
Secrets and local settings:.env, appsettings.Development.json (if it holds secrets), *.pfx
Do not start from a blank file. GitHub's gitignore templates (for example the "VisualStudio" one) cover most cases.
Important: .gitignore only affects files that are not yet tracked. If a file was already committed, run git rm --cached path/to/file and commit. If it contained a password, rotating that password is essential, because the secret remains in the old history.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
A
.gitignorefile lists patterns of files and folders that Git should not track. Put it in the repository root.Usually ignored:
bin/,obj/,dist/,build/node_modules/,packages/,.venv/.vs/,.idea/,.DS_Store,Thumbs.db*.log,*.tmp.env,appsettings.Development.json(if it holds secrets),*.pfxDo not start from a blank file. GitHub's gitignore templates (for example the "VisualStudio" one) cover most cases.
Important: .gitignore only affects files that are not yet tracked. If a file was already committed, run
git rm --cached path/to/fileand commit. If it contained a password, rotating that password is essential, because the secret remains in the old history.