<LEARN/>
← Git & GitHub

// lesson 5 of 9

Ignoring files with .gitignore

Keep secrets and clutter out of your repository.

// 1. read the lesson

Some files should never be saved in Git: passwords and keys, huge downloaded folders, or files your computer creates automatically. A file named .gitignore lists them.

# .gitignore
node_modules/
.env
.DS_Store
*.log

Each line is a pattern. A trailing slash means a folder, and * matches anything. Never commit a .env file with secrets: once it is pushed online, consider those secrets leaked.

Written by the LEARN team.

Sign in to take the lesson test.

Your answers and code are checked and saved to your account.

Sign in