.gitignore Generator

Generate a .gitignore file by selecting your OS, language, framework, and IDE presets. Combines official GitHub gitignore templates with one click and lets you download the result.

What is a .gitignore file?

A .gitignore file tells Git which files and directories to exclude from version control. Without one, build artefacts, dependency folders, IDE settings, and secrets end up in your repository - slowing down clones, leaking credentials, and creating noisy diffs. This generator combines the official GitHub gitignore templates for your chosen OS, language, framework, and IDE so you get a correct, comprehensive file in seconds.

Frequently Asked Questions

Where does the .gitignore file go?

Place it in the root of your repository - the same directory as .git/. Git also supports per-directory .gitignore files if you need finer-grained rules for specific subdirectories, and a global ~/.gitignore_global for machine-wide rules (IDE files, macOS metadata).

Why isn't Git ignoring a file I added to .gitignore?

Git only ignores untracked files. If the file is already tracked (has been committed), adding it to .gitignore has no effect. Remove it from tracking first: git rm --cached path/to/file then commit the change. After that, Git will ignore future changes.

How do negation patterns work?

Prefix a pattern with ! to un-ignore a file previously matched by a broader pattern. For example: logs/* ignores everything in logs/, and !logs/.gitkeep keeps the placeholder file so Git tracks the empty directory. Order matters - later rules override earlier ones.

Should I commit .env to Git?

Never commit .env files containing real credentials. Commit .env.example with placeholder values instead. The Laravel, Node.js, and Django presets above already ignore .env and allow .env.example. If you accidentally committed a secret, assume it is compromised - rotate the credential immediately.

What is the difference between / prefix and no prefix?

vendor/ matches a directory named vendor anywhere in the tree. /vendor/ only matches at the root of the repository. Use / prefix when you have a top-level directory to ignore and want to avoid accidentally matching a deeply-nested folder with the same name.

Related tools