A .gitignore file ready in a few clicks
A .gitignore file sits at the root of a code repository and lists what version control should leave out: downloaded dependencies, compiled files, logs, the passwords in your .env file, and the hidden files your operating system or editor creates. This gitignore generator puts that file together for you from 49 templates, with no duplicate lines.
Nothing is sent: the file is built in your browser. Your selection and your own lines are remembered on this device for next time.
How to use it
- In "Search templates", type a word such as
python,nodeorlogto filter the list. - Tick the templates you need. They are sorted into four groups: "Languages", "Frameworks and build tools", "Environments, secrets and generated files" and "System and editor files". "Untick all" starts again from scratch.
- The result appears straight away in ".gitignore file", with the number of templates, rules and duplicates removed.
- Add your own paths under "Your own lines (added at the end)", one per line, for example
uploads/. - Untick "Commented sections" if you want a file without the
# …headings. - Click "Download .gitignore" or "Copy".
Some browsers strip the leading dot from a downloaded file name. If you get a file called gitignore, just rename it to .gitignore and drop it into the root of your project.
Example: a Node.js app built with Vite
Tick "Node.js", "Vite" and "Logs (*.log)". Both the Node.js and Vite templates contain node_modules/, so the tool writes it once and shows "Templates: 3 · rules: 17 · duplicates removed: 1". The Vite section keeps only dist/, dist-ssr/, *.local and .vite/. Then add "Secrets and .env" so that API keys never end up in a public repository.
For a Python project, "Python", "Virtual environments (.venv…)" and "Secrets and .env" cover the basics. Add "Folder metadata (.DS_Store…)" and "Thumbnails and folder settings (Thumbs.db…)" if your team works across different operating systems.
The rules worth knowing
| Line | Effect |
|---|---|
*.log | every file ending in .log, anywhere in the project |
logs/ | any folder called logs, with everything inside |
/vendor/ | the vendor folder at the root only |
!.env.example | exception: this file stays tracked despite .env.* |
**/*.rs.bk | these files in any subfolder |
Order matters: an exception starting with ! must come after the rule it overrides. The generator keeps the templates in order and puts your own lines last, so they have the final say. A line starting with # is a comment.
The .gitignore is not the only hidden file worth having at the root of a website: for redirects and server-side caching, try the htaccess generator, and to guide search engine crawlers, the robots.txt generator. If your project relies on YAML configuration files, run them through the YAML validator before you commit.
FAQ
I added a rule but the file is still tracked. Why?
A .gitignore only applies to files that are not tracked yet. For a file already committed, remove it from the index with git rm --cached path/to/file (it stays on your disk), then commit the change.
Should I ignore the dependency lock file?
Usually not. Files such as package-lock.json or composer.lock pin exact versions, so keep them tracked in an application. None of the templates ignores them, except the Dart template, which ignores pubspec.lock as is customary for a library.
My passwords have already been pushed. Is a .gitignore enough?
No. Ignoring the .env file stops future leaks, but the history still holds the old version. Change the passwords and keys involved right away.
Can I have more than one .gitignore file?
Yes. Any folder can have its own, and its rules apply to that folder and everything below it. A single file at the root is still the easiest to read.