# Migration — NAS folder → `Charlie/` repo For `init`-type stacks. Run on the owner host. Container keeps running throughout. ```bash # 0. In Gitea UI: create empty Charlie/, private, uninitialized. cd /mnt/nas/home/ ls -la && du -sh */ 2>/dev/null # spot the heavy state dirs git init -b main # .gitignore BEFORE first add — never stage runtime state $EDITOR .gitignore # see template below cp .env .env.example $EDITOR .env.example # redact every secret git add . git status git diff --cached --stat # If state dirs slipped through: fix .gitignore, `git rm --cached -r `, repeat. git commit -m "Initial import from /mnt/nas/home/" git remote add origin https://gitea.alexandru.macocian.me/Charlie/.git git push -u origin main ``` ## `.gitignore` template ```gitignore # runtime state data/ db-data/ appdata/ *-data/ cache/ logs/ *.log *.sqlite* # secrets .env .env.* !.env.example ``` Tune per stack — e.g. `paperless-ngx` also has `consume/`, `export/`, `media/`, `media-bk/`. ## `rewrite`-type ```bash cd /mnt/nas/home/ git remote rename origin github 2>/dev/null || true git remote add origin https://gitea.alexandru.macocian.me/Charlie/.git git push -u origin main ``` ## `upstream+overrides` ```bash cd /mnt/nas/home/ git remote rename origin upstream git remote add origin https://gitea.alexandru.macocian.me/Charlie/.git # create our overlay branch git checkout -b charlie # add our files: docker-compose.override.yml, .env.example, custom Dockerfile… git add docker-compose.override.yml .env.example git commit -m "Charlie overrides" git push -u origin charlie ``` The pipeline tracks `origin/charlie`, not upstream's default. ## `mirror` No host-side action. In Gitea: New Migration → **Pull mirror** → upstream URL → schedule (e.g. daily). Repo lives at `Charlie/` and is read-only. ## Post-migration check ```bash git -C /mnt/nas/home/ status # should be clean git -C /mnt/nas/home/ remote -v # origin → gitea sudo docker compose ps # still up ```