DevOps

Gitignore Generator

Pick your languages, frameworks, editors and OS to generate a ready-to-use .gitignore file. Combine as many templates as you need.

Guide: Gitignore for .env Files: Keep Secrets Out of Git

Selected

Ready.

What it does

Select every language, framework, editor and operating system that applies to your project, and the tool combines the matching patterns into one file, each under a labelled section.

How to use

  1. Select templates from the list, or filter by name first.
  2. Review the result, since some frameworks share overlapping patterns.
  3. Copy it or download it directly as .gitignore.

Good to know

These templates cover the common cases for each entry, similar in spirit to GitHub's own gitignore templates, but are not a byte-for-byte copy of any single source. Review the file for anything specific to your project (build output folders, local config, secrets) that these general templates would not know about.

Example

A Node project edited on a Mac would select Node and macOS. The result has a ### Node ### section with node_modules/, log files, dist/ and .env files, followed by a ### macOS ### section with .DS_Store. macOS, Windows and Linux start selected; use the chips under "Selected" to remove one, or "Clear selection" to start over.

Things to check

  • Secrets. Only some templates (Node, React, Next.js, Laravel) list .env files. If your stack keeps secrets elsewhere, add that file yourself. To read or convert an existing .env file, use the .env ⇄ JSON Converter.
  • Lock files. The Rust template ignores Cargo.lock and the Dart template ignores pubspec.lock, which suits libraries. Applications usually commit them, so delete those lines for an app. The Dart template also ignores generated *.g.dart files; remove that line if you commit generated code.
  • Wrapper files. The Java template ignores *.jar but keeps gradle/wrapper/gradle-wrapper.jar and .mvn/wrapper/maven-wrapper.jar so the build wrappers still work.
  • Order matters. A line starting with ! re-includes a file only if it comes after the pattern that ignored it, so do not sort or reorder the lines.
  • Already tracked files. A .gitignore does not affect files Git already tracks. Remove them from the index with git rm --cached path and commit.

If you already have a .gitignore, paste both versions into the Text Diff Checker to see what the generated file would add.

Example: Node and Python together

macOS, Windows and Linux are selected by default, because their operating-system files (such as .DS_Store and Thumbs.db) should never be committed. Adding Node and Python produces a file with a labelled section for each template, for example:

### Node ###
node_modules/
npm-debug.log*
dist/
build/
coverage/
.env
.env.local

### Python ###
__pycache__/
*.py[cod]
.venv/
.pytest_cache/

Notice that .env is ignored. Files with passwords and API keys should stay out of the repository. If one was ever committed, rotating the secret matters more than deleting the file; you can check text for leaked secrets with the Secret Scanner.

Using the file

  • Save the result as .gitignore in the root of your repository, then commit it.
  • A .gitignore does not affect files that Git already tracks. To stop tracking one, run git rm --cached on it, then commit.
  • For operating-system and editor files that you never want in any project, a global ignore file is cleaner: set it with git config --global core.excludesfile.

Frequently asked questions

How many templates are there?

27, covering languages, operating systems, editors and frameworks. Use the search box to filter them.

Can I edit the result?

Yes. You can copy or download the text and add your own lines, such as the names of local build folders.

Is anything sent to a server?

No. The templates are part of the page and the file is assembled in your browser.

Privacy

This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.

Share this tool

Your data is not included in this link.