# Secrets and .env Files

A secret such as a token or an API key never goes in a script: it goes in a .env file beside the project, which the script loads with set -a and source, which Git is told to ignore, and which chmod 600 keeps private to you.

![Cheat sheet for the lesson Secrets and .env Files: A secret such as a token or an API key never goes in a script: it goes in a .env file beside the project, which the script loads with set -a and source, which Git is told to ignore, and which chmod 600 keeps private to you.](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/0fc6bcdcd43c4fb2993dbbec3692b4a5.webp)

- Category: Bash
- Level: Journeyman
- Tags: API Key, chmod, env-file, environment-variable, gitignore, linux, unix
- Updated: November 10, 2026

Source: https://www.ask-codey.com/cheat-sheets/bash-env-files-and-secrets-cheat-sheet
