env
A site has a live environment and optionally one or more staging environments. The env commands manage those environments and move content between them. For actions on the whole site, see sites.
kinstactl env list my-sitekinstactl env clone my-site dev --from livekinstactl env push my-site --from staging --to liveCommands that change an environment wait for Kinsta to finish by default, and accept --no-wait, --timeout <minutes> and --dry-run; see operations. --dry-run prints the resolved target and the request that would be sent, and changes nothing.
env list
Section titled “env list”List the environments of a site.
kinstactl env list my-sitekinstactl env list [site] [options]List the environments of a site
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
Kinsta API: GET /sites, GET /sites/{site_id}/environments
Use it to find the names you pass to --env on other commands.
env push
Section titled “env push”Push the database and/or files of one environment to another.
kinstactl env push my-site --from staging --to livekinstactl env push [site] [options]Push the database and/or files of one environment to another
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
Options
| Option | Description |
|---|---|
--from <env> | source environment |
--to <env> | target environment (gets overwritten) |
--no-db | do not push the database |
--no-files | do not push files |
--no-search-replace | do not run search and replace on the database |
--path <path...> | push only these paths instead of all files |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
--yes | skip the confirmation prompt |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, PUT /sites/{site_id}/environments
--to is overwritten with the content of --from, so the command asks for confirmation first. On a terminal you answer a prompt. In a script, pass --yes, otherwise it fails with CONFIRMATION_REQUIRED (exit code 5). Without --from or --to, a terminal asks which environment you mean; in a script both are required, and they must be different environments.
By default the database and all files are pushed, and a search and replace is run on the database. Narrow that down with the --no- options:
kinstactl env push my-site --from staging --to live --no-db --path wp-content/themes --yes--no-dband--no-filesskip one half of the push. Pushing neither is aUSAGEerror.--no-search-replaceskips that search and replace.--pathpushes only the given files or folders instead of all files, and cannot be combined with--no-files.
env create
Section titled “env create”Create a new environment for a site.
kinstactl env create my-site dev --admin-user admin --admin-email [email protected] --admin-password -kinstactl env create <site> <display-name> [options]Create a new environment for a site
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
display-name | display name of the new environment |
Options
| Option | Description |
|---|---|
--plain | create an empty environment without WordPress |
--premium | create a premium staging environment |
--admin-user <name> | WordPress admin user name |
--admin-email <email> | WordPress admin email |
--admin-password <password> | "-" reads it from stdin; omitted on a TTY prompts for it |
--title <title> | site title (default: the display name) |
--language <code> | WordPress language |
--multisite | install WordPress as a multisite |
--subdomain-multisite | make the multisite use subdomains |
--woocommerce | install WooCommerce |
--yoast | install Yoast SEO |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, POST /sites/{site_id}/environments, POST /sites/{site_id}/environments/plain
By default the new environment gets a fresh WordPress install, so it needs the admin user, email and password, like sites create. Pass --plain for an empty environment without WordPress, and --premium for a premium staging environment.
env clone
Section titled “env clone”Clone an environment into a new environment of the same site.
kinstactl env clone my-site dev --from livekinstactl env clone <site> <display-name> [options]Clone an environment into a new environment of the same site
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
display-name | display name of the new environment |
Options
| Option | Description |
|---|---|
--from <environment> | environment to clone |
--premium | create a premium staging environment |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, POST /sites/{site_id}/environments/clone
This is the quickest way to get a staging copy of live. To clone into a new site instead of a new environment, use sites clone.
env delete
Section titled “env delete”Delete an environment.
kinstactl env delete my-site --env staging --confirm my-sitekinstactl env delete [site] [options]Delete an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
--confirm <site-name> | the site name, to confirm an irreversible action |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, DELETE /sites/environments/{env_id}
Deleting an environment cannot be undone, so --yes is not accepted. Confirm by typing the site name when prompted, or pass it as --confirm <site-name> in a script. Run it with --dry-run first to check which environment is selected.
env php-allocation
Section titled “env php-allocation”Change the PHP allocation of a premium staging environment.
kinstactl env php-allocation my-site --env staging --threads 4 --memory 256kinstactl env php-allocation [site] [options]Change the PHP allocation of a premium staging environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
--threads <n> | number of PHP threads |
--memory <mb> | memory per PHP thread in MB |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, POST /sites/environments/{env_id}/change-environment-php-allocation
This is only for premium staging environments. The allocation of the live and the standard staging environment is changed per site with sites php-allocation.
env webroot
Section titled “env webroot”Change the webroot subfolder of an environment.
kinstactl env webroot my-site /public --env livekinstactl env webroot <site> <subfolder> [options]Change the webroot subfolder of an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
subfolder | webroot subfolder, e.g. /public or / |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
--no-clear-cache | do not clear all caches afterwards |
--no-refresh | do not refresh the plugin and theme inventory |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, POST /sites/environments/{env_id}/change-webroot-subfolder
Use this when the site should be served from a subfolder such as /public. Pass / to serve from the root again. After the change kinstactl clears all caches and refreshes the plugin and theme inventory, unless you pass --no-clear-cache or --no-refresh.
env files
Section titled “env files”Show the file tree of an environment.
kinstactl env files my-site --env livekinstactl env files [site] [options]Show the file tree of an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
Global options --profile, --json and --no-input apply too. See scripting and CI.
Kinsta API: GET /sites, GET /sites/environments/{env_id}/file-list
Handy to check which paths exist before you use --path with env push.