Configure repositories with replicas.json
Replicas looks for a replicas.json file at the root of your Git repository whenever you run replicas connect or replicas code. It keeps secrets, assets, and tunnels consistent across every workspace spun up from that repo.
File schema
copy(optional) — array of file paths or glob patterns relative to the repo root. These files sync into the workspace before your shell opens. Directories are copied recursively.ports(optional) — array of integers. Each port is forwarded from the workspace to your machine. The CLI finds open local ports automatically and prints the mapping.
Coming soon: command hooks so you can declare scripts (e.g., npm run dev) that run right after copy + tunneling.
How copying works
- Run
replicas connect my-workspace --copy. - The CLI confirms you are inside a Git repo and locates
replicas.json. - Each
copyentry is validated; missing files are flagged but do not stop the session. - Files are uploaded via
scpto the workspace path/home/ubuntu/workspaces/<repo-name>/.
.env out of Git and in your local filesystem. You decide when they sync to the VM.
How port tunneling works
- For every port in
ports, the CLI adds an SSH tunnel (-L local:remote). - If a port is taken locally, Replicas picks the next free one and prints
remote 3000 → local 3001. - Tunnels stay alive as long as your
connectorcodesession is active.
Best practices
- Commit
replicas.jsonto the repo so everyone shares the same setup. Store sensitive values in the files referenced bycopy, not in the JSON itself. - Pair
replicas.jsonwith template custom commands to auto-install dependencies before you connect. - Rotate secrets regularly. Replicas does not keep copies server-side once the session ends.