Skip to content
Justice Tech School

.gitignore

A .gitignore file lists patterns Git should not track, such as node_modules/, .env and build output. It only affects files that are not yet tracked. Never commit secrets.

Example
printf "node_modules/\n*.log\n.env\n" > .gitignore
mkdir node_modules; echo x > node_modules/lib.js
echo "secret" > .env
echo "debug" > app.log
echo "code" > app.js
git status -s

Result

?? .gitignore
?? app.js

Exercise

Name of the ignore file.

Quiz Test

Which should never be committed?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.