Laravel .gitignore Template

The full, current Laravel .gitignore template — copy it as-is, or head to the .gitignore Generator to merge it with other stacks into one file.

Template

/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode

What each entry does

Why every line in this template is excluded, not just what it matches.

Entry Why it's excluded
/node_modules Installed npm/yarn/pnpm packages — fully reproducible from package.json and the lockfile, and can run into the tens of thousands of files.
/public/build A generated/local directory (public/build) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
/public/hot A generated/local directory (public/hot) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
/public/storage A generated/local directory (public/storage) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
/storage/*.key Files matching /storage/*.key — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
/vendor PHP Composer's (or Go modules', in older tooling) installed dependencies — reproducible from composer.lock/go.mod, not source.
.env Local environment variables — routinely holds real secrets (API keys, DB passwords), so it must never be committed. Commit a .env.example instead.
.env.backup A backup copy of a real .env file, carrying the same secrets — still shouldn't be committed.
.env.production Production environment variables/secrets — the highest-stakes file to accidentally commit.
.phpactor.json Files matching .phpactor.json — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.phpunit.cache PHPUnit's test-result cache, used to speed up repeat test runs — safe to regenerate, no value shared.
Homestead.json A Laravel Homestead per-developer VM config — machine-specific, not meant to be shared.
Homestead.yaml A Laravel Homestead per-developer VM config — machine-specific, not meant to be shared.
auth.json Composer's private-registry credentials file — a secret.
npm-debug.log Files matching npm-debug.log — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
yarn-error.log Files matching yarn-error.log — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
/.fleet Files matching /.fleet — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
/.idea JetBrains IDEs' (IntelliJ, Rider, PyCharm, Android Studio, WebStorm...) per-project settings — mostly machine/user-specific.
/.vscode VS Code's per-project settings folder — often partially committed (shared settings.json) but user-specific bits shouldn't be.