---
title: "ezgh deploy init"
description: "Write a one-service EZGHDeploy for the repository."
---

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

# ezgh deploy init

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh deploy init [--name n] [--branch b] [flags]
```

Write EZGHDeploy at the root of the checkout: one web service, and a production environment deploying the checked-out branch (or `--branch`) into your project (`--project`, `EZGH_PROJECT` or the profile's, written as given).

With a Dockerfile at the root, the service is built from it, on the port of its last EXPOSE (or `--port`, which a Dockerfile with no EXPOSE needs). Without a Dockerfile, the service is built as `ezgh deploy detect` says, on the port detection finds; when detection can't tell how, nothing is written.

A Mastra app gets an agents service that may use EZGH Sandboxes, a Postgres database, and a sandbox image for sandbox/Dockerfile and each sandbox/&lt;name&gt;.Dockerfile; with a Chat SDK adapter (@chat-adapter/&lt;platform&gt;) in its dependencies, agents is public at its CDN hostname for the platforms' webhooks. init then prints the next steps.

An existing EZGHDeploy is replaced only with `--force`. Every file written is one `ezgh deploy validate` accepts. Nothing is sent anywhere.

Part of [`ezgh deploy`](/cli/reference/deploy).

## Examples

```sh
ezgh deploy init
ezgh deploy init --name shop --branch main
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--branch` | string |  | the branch production deploys (default: the one checked out) |
| `--force` | boolean |  | replace an existing EZGHDeploy |
| `--name` | string |  | the stack's name (default: the repository directory's) |
| `--port` | int |  | the port the service listens on (default: the Dockerfile's EXPOSE, or the one detected) |

Inherited from parent commands:

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--dir` | string | `.` | the repository's checkout (any directory inside it) |
| `--json` | boolean |  | print JSON, as -o json does |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/deploy-init/index.mdx
