.gitignore Generator

Build a .gitignore for your languages, OS and editor




  

How to create a .gitignore file

  1. Tick the languages, frameworks, operating systems and editors your project uses, for example Node, Next.js, macOS and VS Code. Use the filter box to find one quickly.
  2. Add any project-specific paths in Extra rules.
  3. The combined file is built instantly, with duplicate rules removed and a comment heading for each section.
  4. Download it (it saves as .gitignore) and put it in the root of your repository, or copy it into an existing file.

How .gitignore rules work

Rules are read from top to bottom and later rules win, which is why negations come after the rules they override.

Keep secrets out of Git

The Environment files template ignores .env files and private keys while keeping a .env.example you can commit as documentation. Leaked API keys in public repositories are found by bots within minutes, so add these rules before your first commit. If a secret was already committed, ignoring it is not enough: remove it from history and rotate the key.

Operating-system and editor files such as .DS_Store and .idea/ can also go in a global ignore file (git config --global core.excludesFile ~/.gitignore_global) so you do not repeat them in every project.

Why is a file still tracked after I added it to .gitignore?

.gitignore only affects untracked files. Run git rm --cached path/to/file, then commit, to stop tracking a file that is already in the repository.

How do I check why a file is ignored?

Run git check-ignore -v path/to/file. Git prints the rule and the .gitignore file that matched.

Should I commit package-lock.json or yarn.lock?

Yes. Lock files make installs reproducible, so they are deliberately not ignored by the Node template.

Made by BufferMint. We also design and build software products for founders. See our services →

Your files and inputs never leave your device; we only count anonymous visits.