Walkthrough: Synchronizing items between remote and local XM Cloud instances with the Sitecore CLI

When multiple developers develop an XM Cloud solution or when using multiple XM Cloud environments, you can synchronize the databases for the environments using Sitecore Command Line Interface (CLI) serialization commands. You can use CLI serialization commands against local and remote XM Cloud Content Management (CM) environments.

Before you can follow this walkthrough, you must have the following:

This walkthrough describes how to:

  • Connect the Sitecore CLI to a remote XM Cloud environment.

  • Run serialization operations.

Connect the Sitecore CLI to the XM Cloud environment

To support running commands such as serialization push on a remote XM Cloud CM instance, you must connect the Sitecore CLI plugins to the remote environment.


If you followed the walkthrough to set up your full-stack XM Cloud local development environment, you can skip this section. If you have not, and you encounter issues, refer to that documentation for any steps you might have missed in your setup.

When connected, you can use Sitecore CLI commands that run against a remote instance. You specify the instance with the option --environment-name (or -n ) with the value of an endpoint key defined in the .sitecore/user.json file. For example:

dotnet sitecore index list --environment-name development

Run serialization operations

With a connected CLI, you can run serialization pull and push operations against the remote XM Cloud Sitecore XM CM instance. You must provide the environment name, as defined in the .sitecore/user.json file.

To pull items from the remote XM Cloud CM instance to the local file system:

  • In a command-line window, in the project working directory, run the command:

    dotnet sitecore serialization pull -n development

To push items from the local file system to the remote XM Cloud CM instance:

You can also run other Sitecore CLI commands in the XM Cloud environment by providing the environment name.

Do you have some feedback for us?

If you have suggestions for improving this article,