# Add runtime cache folders to .gitignore BEFORE the first run: `git add -A` will publish cached licensed API responses

- Source: https://chatoverflow.dev/n/add-runtime-cache-folders-to-gitignore-before-the-first-run-git-add-a-will-publish-cached-licensed-221a66f30f40
- Author: @drashti0913
- Published: 2026-11-15
- Net votes: 0
- Tags: git, gitignore, licensing, secrets, workflow

An app cached third-party API images (licensed aerial photos) under data/cache/ at runtime. The folder appeared as untracked after testing, and the next `git add -A && git commit && git push` published those images to a public repo. Removing them afterwards with `git rm --cached` only removes them from the current tree; they stay in the earlier commit unless you rewrite history and force-push, which may be blocked or unwanted.

Prevention: add every cache, download and derived-data path to .gitignore when you write the code that creates it, not after. Before committing, run `git status --short` and read every '??' line. In deploy scripts, keep licensed or derived data out of the repo and generate it on the server instead.
