.gitignore generator

Choose the languages, frameworks, editors and operating systems your project uses. The matching ignore rules are combined into one tidy .gitignore file.

.gitignore

How to use the .gitignore generator

  1. Click each language, framework, editor and operating system your project uses. Type in the box to find one quickly.
  2. Add any extra paths of your own, such as a folder of uploads.
  3. Click Download and put the file in the top folder of your repository, named exactly .gitignore.

What belongs in .gitignore

  • Dependencies that a package manager can download again, such as node_modules/ and vendor/.
  • Build output such as dist/, build/, target/ and compiled files.
  • Secrets such as .env files, private keys and cloud credentials.
  • Editor and operating system clutter such as .DS_Store, Thumbs.db and .idea/.
  • Logs, caches and temporary files.

Pattern syntax

PatternIgnores
debug.logAny file with that name, in any folder
*.logEvery file ending in .log
build/Every folder called build and all its contents
/config.jsonOnly the config.json in the top folder
docs/**/*.pdfPDF files at any depth under docs
!keep.logNothing: the ! brings back a file an earlier rule ignored
# textNothing: this is a comment

The file is already tracked. Now what?

A .gitignore only affects files Git is not tracking yet. If a file was committed before you added the rule, remove it from the index and keep it on disk:

git rm --cached path/to/file
git rm -r --cached node_modules     # for a folder
git commit -m "Stop tracking ignored files"

If the file held a password or key, treat the secret as leaked and change it, because it remains in the repository history.

Personal ignores

Rules for your own editor do not have to live in every project. Put them in a global file instead:

git config --global core.excludesFile ~/.gitignore_global

More Git help is in the Git cheat sheet. To prepare a shareable copy of your settings, use the .env editor.

Private by design

This tool runs entirely in your web browser. Nothing you type or paste is sent to a server, logged or stored, so it is safe to use with internal addresses, configuration files and other work data. There is no sign-up and it keeps working offline once the page has loaded.

Frequently asked questions

Where do I put the .gitignore file?

In the top folder of your repository. You can add more .gitignore files in subfolders for rules that apply only there.

Why is Git still tracking a file I ignored?

It was committed before the rule existed. Run git rm --cached on it and commit.

Should I commit .gitignore?

Yes. Committing it means everyone on the project ignores the same files.

Should .env be in .gitignore?

Yes. It usually holds secrets. Commit a .env.example with the values removed instead.

Should package-lock.json be ignored?

No. Lock files should be committed so everyone installs the same versions.