> ## Documentation Index
> Fetch the complete documentation index at: https://docs.machine0.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Sync

> CLI reference for syncing files between your local machine and VMs.

Uses rsync over SSH. Requires rsync on both ends (pre-installed on all machine0 images and macOS).

## push

```bash theme={"theme":"css-variables"}
machine0 sync push <local-path> <vm>:[remote-path] [flags]
```

| Flag          | Description                                  |
| ------------- | -------------------------------------------- |
| `--username`  | SSH username                                 |
| `--dry-run`   | Show what would transfer                     |
| `--delete`    | Delete remote files that don't exist locally |
| `-w, --watch` | Watch for changes and re-sync automatically  |

Remote path defaults to `~/` if omitted.

```bash theme={"theme":"css-variables"}
machine0 sync push ./src myvm:~/app
machine0 sync push ./src myvm:~/app --watch
machine0 sync push ./project myvm:~/project --delete
```

***

## pull

```bash theme={"theme":"css-variables"}
machine0 sync pull <vm>:[remote-path] <local-path> [flags]
```

| Flag         | Description                               |
| ------------ | ----------------------------------------- |
| `--username` | SSH username                              |
| `--dry-run`  | Show what would transfer                  |
| `--delete`   | Delete local files that don't exist on VM |

```bash theme={"theme":"css-variables"}
machine0 sync pull myvm:~/app ./src
```
