99tools

.gitignore & Licence Generator

runs in your browser

Build a .gitignore from GitHub’s templates and test which line ignores a path, or make a LICENSE file — MIT, Apache, GPL and more — with your name on it.

Make

Templates from github/gitignore; licence texts as published by choosealicense.com. Nothing is uploaded.

Loading templates and licences…

about this tool

A .gitignore from GitHub's own templates

Choose the languages, frameworks, editors and operating systems in the project and the .gitignore is put together from github/gitignore — GitHub's template collection, whose top-level templates fill the list when you create a repository, dedicated to the public domain under CC0. The templates are joined in the order you picked them, each under a heading that names the file it came from, and your own lines go last, so they win. A line already written earlier can be left out, which shortens the file — but only where no ! line comes between the two, since a negation can bring a file back in that the repeat would ignore again. Download it, or copy it into a .gitignore in the repository's root folder.

Why is that file ignored, or not?

The path tester answers the question git makes hard to see. Type a path from the repository root — end it with a slash for a directory — and it says whether the .gitignore ignores it, and which line decides, by the rules git documents for gitignore patterns: a pattern without a slash matches at any depth, and one with a slash at the start or in the middle only from the root; a trailing slash matches only directories; * and ? stop at a slash, while ** spans directories; ! brings a path back in, and the last matching line wins. And the rule that surprises most people: once a directory is ignored, git never looks inside it, so nothing in it can be brought back with ! — ignore logs/* rather than logs/ if you want to keep one file. A path typed without its slash is tested as a file, and the tester says if a directory rule would catch it as a directory.

The matching follows git's own wildmatch, including its odd corners — a reversed range such as [z-a], an unclosed bracket or a lone trailing backslash matches nothing — and was checked against git's own git check-ignore on each of these rules. Matching is case-sensitive, as git is by default; tick "ignore case" for a repository on a case-insensitive disk, as macOS and Windows use, where git init turns that on. A Windows path with backslashes is read with git's forward slashes. A file that is already committed stays tracked whatever the .gitignore says, until it is removed with git rm --cached.

A licence with your name on it

Pick a licence and the full text appears, with the year and the copyright holder filled in where the text has a place for them, ready to save as LICENSE — or COPYING for the GPL and COPYING.LESSER for the LGPL, the names GNU uses. Licences whose text has no line for a name — the GNU licences, Apache-2.0, the MPL and others — carry the copyright in each file's header instead. Beside it, in plain words, is what the licence allows, what it requires and what it limits, so the difference between MIT, Apache-2.0, the GPL, the MPL and the rest is on one screen. The texts are the ones choosealicense.com publishes, and GitHub uses when you add a licence; they match the SPDX licence list texts, give or take a title line, a URL, or a word in the GNU licences' how-to-apply appendix. The LGPL-3.0 is a set of extra permissions on top of the GPL-3.0, so a project under it ships both texts.

Each file of the project can then carry a two-line header — the copyright and the licence's SPDX identifier, in the form the REUSE and SPDX specifications use — written in the comment syntax of your language. A REUSE-compliant repository also keeps the licence text in LICENSES/<identifier>.txt. For the GNU licences the identifier says whether later versions are allowed: the old bare GPL-3.0 is deprecated in favour of GPL-3.0-only and GPL-3.0-or-later, and the tool starts on -or-later, the wording the Free Software Foundation recommends. That choice only takes effect in your files' headers or notices, not in the licence text. This is not legal advice; for anything that matters, a lawyer is.

Limits

Sixty of github/gitignore's templates are included — the common languages, frameworks, editors and operating systems — rather than all of its several hundred; the rest can be pasted in as your own lines. The tester reads one .gitignore, at the root: git also reads .gitignore files in subdirectories, .git/info/exclude and your global excludes file, which are not modelled. Eighteen widely used licences are offered. For the secrets that belong in that .gitignore, the .env converter turns a .env file into JSON or YAML. Nothing leaves the page.

questions

Where do the .gitignore templates come from?
From github/gitignore, GitHub’s template collection — its top-level templates fill the list when you create a repository — dedicated to the public domain under CC0. Pick languages, frameworks, editors and your operating system and they are joined in the order you chose, each under a heading naming its source file, with your own lines added last. Lines already written earlier can be left out, but only where that cannot change what is ignored.
Why is a file still being tracked even though it is in .gitignore?
Because .gitignore only affects files git is not tracking yet: a file already committed stays tracked until you run git rm --cached on it. The other common causes are a later ! line that brings it back, a pattern with a slash that is anchored to the wrong directory, and letter case. Paste the path into the tester to see which line decides, by the same rules git uses.
Which licence should I choose?
For most open-source projects the choice is between permissive and copyleft. MIT, Apache-2.0 and BSD let anyone use the code, even in closed products; Apache-2.0 adds an explicit patent grant. The GPL requires anyone who distributes a changed version to release its source under the GPL too, the AGPL extends that to changed versions people use over a network, and the MPL and LGPL sit between. This is not legal advice.
What is the SPDX identifier, and why does GPL-3.0 become GPL-3.0-only?
SPDX identifiers are the short standard names for licences, such as MIT or Apache-2.0, that tools and package registries read. For the GNU licences the bare names are deprecated, because they did not say whether later versions are allowed: GPL-3.0-only means just version 3, GPL-3.0-or-later lets users pick a later version too. The tool writes the current form and a file header in the form the REUSE specification uses.
Are the licence texts exact?
They are the texts choosealicense.com publishes, which GitHub uses when you add a licence to a repository, with [year] and [fullname] filled in where the text has them. They match the SPDX licence list texts, give or take a title line, a URL, or a word in the GNU licences’ how-to-apply appendix. Only the year and holder are changed; the rest of the text must not be.