🚫 CHAPTER 2 · .GITIGNORE
Chef You

Keep Secrets Out
of the Cookbook

Not everything should be in your repository — passwords, build files, IDE junk. .gitignore tells Git what to pretend doesn't exist.

Scene I

The dangerous files

Chef You

Your project has files that should never be committed:

🔑 .env — your API keys and passwords
📦 node_modules/ — thousands of dependency files
🗑️ .DS_Store — macOS junk
⚙️ dist/ — built files that can be regenerated

Put their names in .gitignore and Git will invisibly skip them forever.

🚫 FILE FILTER Click dangerous files to ignore them
# .gitignore
Protected!

🎉 Your secrets are safe

The ignored files will never show up in git status or be included in commits. Your passwords stay local, and your repo stays clean.

Pro tip: check out gitignore.io for ready-made templates for Node, Python, Java, and more.

$ cat .gitignore
node_modules/
.env
dist/
.DS_Store
*.log
Epilogue
Ignore what doesn't belong.
Keep your repo clean
and your secrets hidden.

Rule of thumb: if a file is generated, personal, or secret — it belongs in .gitignore, not in your repository.