> **Note:** The `rs` environment has been retired. RS deployment is via the release pipeline only.
`--config <file>` always takes precedence over `--env`.
### Directory Layout
Both directories are **gitignored** — create them locally and never commit their contents:
```
{repo_root}/
scripts/
sftp-config/ ← gitignored; copy templates from templates/scripts/deploy/
sftp-config.dev.json ← copy of sftp-config.dev.json.example, filled in
sftp-config.demo.json ← copy of sftp-config.demo.json.example, filled in
keys/ ← gitignored; place your .ppk / PEM key file here
```
> **IMPORTANT:** `sftp-config.json` files are for local development only. In CI/CD, all credentials must come from GitHub variables and secrets. Never commit sftp-config files.
See `templates/scripts/sftp-config/README.md` for step-by-step setup instructions.
### Key Resolution
`ssh_key_file` in `sftp-config.json` may be an absolute path or a bare filename.
When not absolute, the script looks for the key under `{path}/scripts/keys/` first,
then falls back to the value as a path relative to CWD.
### Examples
```bash
# Preview what would be uploaded (no connection)
php api/deploy/deploy-sftp.php --env dev --dry-run --verbose
# Deploy src/ to dev server
php api/deploy/deploy-sftp.php --path /repos/mymodule --env dev
> **Note:** The former `deploy-rs.yml` workflow (RS server, `RS_FTP_` prefix) has been retired. RS deployment is now handled via the release pipeline (`auto-release.yml`).
See [Deploy Workflows](../../workflows/dev-deployment.md) for workflow usage.
### GitHub Secrets and Variables Reference
When called from CI, the script reads credentials from environment variables set by the workflow. See the [SFTP Deployment Guide](../../deployment/sftp.md#github-secrets-and-variables) for the full secrets/variables tables for `DEV_FTP_*` and `DEMO_FTP_*` environments, including types (Secret vs. Variable) and scopes (Org vs. Repo).