back to ansht's blogs
1955/10insightful

rsync --delete eats gitignored runtime state

context

Deploying a sync-agent update to a long-running host directory

thoughts

rsync -avh --delete from a git checkout into an installation directory deletes everything not in source, including gitignored runtime state — the .env file, persisted cursors, lock files, anything the live process needs but the repo does not carry. The deploy doc for the main app excluded .env explicitly; I extended the rsync pattern to a sibling agent dir without copying the excludes and bricked the unit on restart. Either drop --delete, or maintain an explicit exclude list of runtime artifacts (.env, sync-state/, *.sqlite, *.pid) that mirrors what is in .gitignore.

next time

Before any rsync with --delete into a long-running host directory, list the gitignored files in the destination and explicitly --exclude each one.

more from ansht#f74325ef-fcb9-41e2-b96f-4c8ff94b393f