Gitignore Generator Online

Pick the languages, frameworks, editors and operating systems in your project and get one .gitignore built from the templates in GitHub's github/gitignore repository. Each template gets a ### Name ### header, lines repeated across templates are removed, and your own rules go at the end.

Then check the result: type a path such as build/app.js or .env.example and DevPrix tells you whether Git would ignore it and which line decides, using the same rules as git check-ignore. It all runs in your browser: the templates are bundled with the page and nothing is uploaded.

Press Enter to add the first match.
Templates3 selected
Selected, in file order
  • Node
  • macOS
  • VS Code
Suggested
Languages & runtimes
Frameworks & engines
Build, infra & tools
Editors & IDEs
Operating systems
Preview.gitignore · 222 lines
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.*
!.env.example

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist
.output

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp directory
.temp

# Sveltekit cache directory
.svelte-kit/

# vitepress build output
**/.vitepress/dist

# vitepress cache directory
**/.vitepress/cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Firebase cache directory
.firebase/

# TernJS port file
.tern-port

# Stores Visual Studio Code versions used for testing Visual Studio Code extensions
.vscode-test

# pnpm
.pnpm-store

# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Vite files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vite/

# Astro generated types
.astro/

# Turbo Repo
.turbo

### macOS ###
# General
.DS_Store
.localized
__MACOSX/
.AppleDouble
.LSOverride
Icon[␍]

# Resource forks
._*

# Files and directories that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.com.apple.timemachine.supported
.PKInstallSandboxManager
.PKInstallSandboxManager-SystemSoftware
.hotfiles.btree
.vol
.file
.disk_label*
lost+found
.HFS+ Private Directory Data[␍]

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Mac OS 6 to 9
Desktop DB
Desktop DF
TheFindByContentFolder
TheVolumeSettingsFolder
.FBCIndex
.FBCSemaphoreFile
.FBCLockFolder

# Quota system
.quota.group
.quota.user
.quota.ops.group
.quota.ops.user

# TimeMachine
Backups.backupdb
.MobileBackups
.MobileBackups.trash
MobileBackups.trash
tmbootpicker.efi

### VS Code ###
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
!*.code-workspace

# Built Visual Studio Code Extensions
*.vsix
Custom linesAdded at the end, as typed
Is this path ignored?One path per line; end folders with /
  • Ignorednode_modules/react/index.js

    Inside node_modules/, which is ignored by line 42 node_modules/ (Node).

  • Ignored.env

    Matched by line 70 .env (Node).

  • Not ignored.env.example

    Re-included by line 72 !.env.example (Node).

  • Not ignoredsrc/index.js

    No line matches, so Git can track it.

  • Ignored.DS_Store

    Matched by line 154 .DS_Store (macOS).

  • Not ignored.vscode/settings.json

    Re-included by line 214 !.vscode/settings.json (VS Code).

  • Ignored.vscode/bookmarks.json

    Matched by line 213 .vscode/* (VS Code).

  • Ignoreddist/

    Matched by line 84 dist (Node).

3 templates117 patterns0 duplicates removed3.3 KBProcessed locally

How to use it

  1. Search or browse the templates and click the ones for your languages, frameworks, editor and operating system, or start from a suggestion.
  2. Add your own rules under Custom lines, then type paths under Is this path ignored? to see which line decides.
  3. Press Download (⌘↵) to save the file as .gitignore in your project's root folder, or copy it.

Related tools

Git Command BuilderDevOpsDocker Run to ComposeDevOpsChmod CalculatorDevOpsInvisible Character FinderText

Next: build the git rm --cached command for files you just ignored in the Git Command Builder, compare your old and new .gitignore in the Text Diff Checker, or find stray invisible characters with the Invisible Character Finder.

What this tool does

The generator bundles 99 templates from github.com/github/gitignore, taken from the repository on 30 October 2026: languages and runtimes, frameworks and game engines, build and infrastructure tools, editors and IDEs, and operating systems. Templates are copied as published, comments included, and appear in the order you pick them. With Remove duplicates on, a pattern line that already appears higher up is dropped, but only when that cannot change the result: if a ! rule that could match the same paths sits between the two copies, the later copy is kept, because Git uses the last line that matches. Custom lines are added at the end exactly as you type them. The path tester applies Git's rules to the whole file: # comments and blank lines, trailing spaces, ! to re-include, a leading or middle / to anchor a pattern to the root, a trailing / for folders only, *, ?, [a-z] and ** wildcards, and the rule that nothing inside an ignored folder can be re-included. It was checked against git check-ignore on more than 100,000 path and pattern combinations. It models one .gitignore at the repository root: nested .gitignore files, .git/info/exclude and your global excludes file are not included, and it cannot know which files Git already tracks.

Example input and output

Rust + VS Code
Input
Templates: Rust, VS Code
Output
### Rust ###
# Generated by Cargo
# will have compiled files and executables
debug
target

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Generated by cargo mutants
# Contains mutation testing data
**/mutants.out*/

# rustc will dump stack traces when hitting an internal compiler error to PWD
rustc-ice-*.txt

# RustRover
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### VS Code ###
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
!*.code-workspace

# Built Visual Studio Code Extensions
*.vsix

debug and target have no slash, so they match a file or folder with that name at any depth. The VS Code lines ignore the .vscode folder's contents but re-include the shared settings, tasks and launch files.

Which line decides? (Node + macOS + VS Code)
Input
node_modules/react/index.js
.env
.env.example
.vscode/settings.json
.vscode/bookmarks.json
src/index.js
Output
Ignored      node_modules/react/index.js
             Inside node_modules/, which is ignored by line 42 node_modules/ (Node).
Ignored      .env
             Matched by line 70 .env (Node).
Not ignored  .env.example
             Re-included by line 72 !.env.example (Node).
Not ignored  .vscode/settings.json
             Re-included by line 214 !.vscode/settings.json (VS Code).
Ignored      .vscode/bookmarks.json
             Matched by line 213 .vscode/* (VS Code).
Not ignored  src/index.js
             No line matches, so Git can track it.

Line numbers refer to the generated file, and the name in brackets is the template the line came from. git check-ignore -v reports the same lines.

Re-including a file inside an ignored folder
Input
Custom lines:
build/
!build/keep.txt

Path: build/keep.txt
Output
Ignored      build/keep.txt
             Inside build/, which is ignored by line 2 build/ (Custom). Git never looks inside an ignored folder, so line 3 !build/keep.txt (Custom) has no effect. To allow exceptions, ignore the folder's contents instead (build/*).

With build/* instead of build/, the same path shows Not ignored, re-included by line 3, while build/app.js stays ignored by line 2.

Common errors and fixes

A file is still committed after adding it to .gitignore
.gitignore only affects files Git does not track yet. Stop tracking the file but keep your copy with git rm --cached path (git rm -r --cached folder/ for a folder), then commit. Earlier commits still contain it, so rotate any credential that was ever committed.
!build/keep.txt has no effect
Git does not look inside an ignored folder, so nothing in it can be re-included. Replace build/ with build/* so the folder's contents are ignored rather than the folder itself, and keep the ! line below it. The path tester names the ! line that is blocked.
/build and build/ ignore different things
A leading / anchors a pattern to the folder that holds the .gitignore, so /build matches only the top-level build, file or folder. A trailing / matches folders only, at any depth: build/ matches src/build/ but not a file called build. Plain build matches both, anywhere.
docs/*.md does not match a/docs/guide.md
Any slash except a trailing one anchors the pattern to the .gitignore's folder, and * never crosses a /. Write **/docs/*.md to match at any depth, or docs/**/*.md to include subfolders of docs.
A template ignores more than expected, such as src/lib
Template lines without a slash match at any depth: the Python template's lib/ also ignores src/lib/, and Rust's debug ignores any file or folder named debug. Add an exception after the template, such as !src/lib/, or anchor the line as /lib/. Test the path here to see which line decides.
A pattern with a trailing tab or a pasted invisible character matches nothing
Git trims trailing spaces from a pattern but keeps tabs and characters such as a non-breaking space, so the pattern looks for a name that ends in them. Delete them. To match a name that really ends in a space, escape it: foo\ .
.gitignore made with echo in Windows PowerShell is ignored
In Windows PowerShell 5, echo node_modules > .gitignore writes UTF-16 text, which Git cannot read. Save the file as UTF-8 instead, for example with Set-Content .gitignore node_modules -Encoding utf8, or download it from this page.

Common use cases

  • Starting the .gitignore for a new repository in any language
  • Combining language, framework, editor and OS rules for a monorepo
  • Finding out which line makes git add skip a file
  • Checking that a ! exception really re-includes the file you need
  • Adding editor and operating-system rules to an existing project

Privacy and security notes

  • The templates are bundled with the page and the file is built by JavaScript in this browser tab. The templates you pick, your custom lines and the paths you test are not sent to DevPrix or GitHub.
  • The path tester only looks at the paths you type. It does not read your disk or your repository, and nothing you type is stored.

Frequently asked questions

How do I set up a global .gitignore for all my repositories?

Put rules for your own machine, such as macOS's .DS_Store or your editor's folders, in one file and point Git at it: git config --global core.excludesFile ~/.gitignore_global. If you never set it, Git reads $XDG_CONFIG_HOME/git/ignore, which is ~/.config/git/ignore by default. Those rules apply to every repository on your computer but not to your teammates, so rules the project needs belong in the repository's own .gitignore.

How do I ignore a file only in my copy of a repository?

Add it to .git/info/exclude. It uses the same syntax as .gitignore but lives inside the .git folder, so it is never committed or shared. It only works for untracked files; for a tracked file you want Git to stop showing as changed, such as a local config, git update-index --skip-worktree path tells Git to leave your copy alone, and --no-skip-worktree undoes it.

How can I check why a file is ignored?

Run git check-ignore -v path. It prints the file, line number and pattern that decides, for example .gitignore:42:node_modules/ followed by the path, including a ! line that re-includes it. Add --no-index to check a file that is already tracked, and use git status --ignored to list ignored files. The tester on this page applies the same rules to the generated file.

Can I use these templates in my project?

Yes. They come from github.com/github/gitignore, which GitHub publishes under CC0-1.0, a public-domain dedication, so you can copy, change and commit them without attribution. This page bundles 99 of them as of commit 47c9b1c from 30 October 2026; the upstream repository may have changed since.

Why wasn't the download saved as .gitignore?

Files whose names start with a dot are hidden on macOS and Linux, and some browsers rename them when saving, for example to gitignore or gitignore.txt. Show hidden files, or rename the download to .gitignore in your project's root folder. You can also Copy the text and paste it into a new file.