A .gitignore file tells version control which files and directories to exclude from tracking. For vibe coders, a proper .gitignore is critical — AI-generated projects often create node_modules, environment files with API keys, build artifacts, and other files that should never be committed to a repository.
A .gitignore file is a small file with an outsized impact on security. It's one of the first things to set up in any vibe-coded project.
.env, .env.local, .env.productionnode_modules/, vendor/, venv/dist/, build/, .next/.vscode/settings.json, .idea/.DS_Store, Thumbs.dbpackage.json, tsconfig.jsonpackage-lock.json, bun.lockbExposing secrets in version control is one of the most common security mistakes:
A .gitignore prevents this entirely.
Most AI tools generate a .gitignore when scaffolding a project. Always verify it includes:
If AI doesn't generate one, ask: "Create a .gitignore for this project that excludes secrets, dependencies, and build output."