Below is the recommendation from Sitecore Before Starting Setup CLI for your Sitecore application.

Below are steps to set up Sitecore CLI for your Sitecore Application.
1) Reference: Sitecore Management Services
Sitecore Management Services is a package that you must download and install in your Sitecore Content Management (CM) instance to support Sitecore Command Line Interface
The download page: Sitecore Downloads: Sitecore CLI 300
From the download page, please download the highlighted package
Note: Always install an updated version of the Sitecore CLI module into your Sitecore CMS,
Because the updated version is supporting the Lower version of Sitecore XP versions. As shown below image yellow highlighted link, click on that and you can find the latest Sitecore CLI module.

2) Install Sitecore CLI module Package on your Sitecore CM Instance.

3) To install Sitecore CLI for your Project, to follow below steps.
a) Open Power Shell / CMD with administrator privileges.

b) Go to Project Path from Command Line
cd <project folder>

c) Run the following command
i)dotnet new tool-manifest
ii) dotnet nuget add source -n Sitecore https://sitecore.myget.org/F/sc- packages/api/v3/index.json
iii) dotnet tool install Sitecore.CLI
iv) To initialize your new project, run the following command in your project folder:
dotnet sitecore init
v) Install the requiredPublishingandSerializationplugins:
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Serialization
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Publishing
vi) To check the installed plugins
dotnet sitecore plugin list
4) Version Control –Serialized Content
You will see the module definitions and serialized items
a) Need to create the Module.Json file, which is having specific Sitecore Layer information, which we want to serialize for respective project.


You can see the path configured for serialization Item of CMS into sitecore.json file


5) CLI Initialization and connect Sitecore Application(Visual Studio ) to Local Sitecore CMS instance.
- Open PowerShell
- Switch the directory to your solution folder. (for ex: D:\Sonic\repo)
- Use the below command to login into your CM instance.
dotnet sitecore login –authority <<identityserverurl> –cm <<cm instance url>> –allow-write true

for ex: identityServerUrl = https://sc10u1identityserver.dev.local
CM = https://sc10u1sc.dev.local
- It opens browser for authentication.
- Once the login is successful, click on the “Yes Allow” button on the permission window.
- Come back to your PowerShell window once the connection is established


After authentication, user.json file will create, which having info about Sitecore instance and access token, using that one to utilize the pull/push and watch command for that particular Sitecore instance.
6) Pull items from your local CM instance into Visual Studio Application.
Run the below command
dotnet sitecore ser pull
This will pull all the changes from local CM instance to your file system.
7) Push items to your local instance
dotnet sitecore ser push
This will push all the changes from file system to your local instance.
8) Enable Watch
Run the below command to enable transparent sync
dotnet sitecore ser watch
You must run this command before you start making any changes to your items in your local instance. This will automatically serialize your items to file system.
9) Check-in you changes
Check-in your changes.
This will also check-in your sitecore definition items along with content and data source items that you have updated on your local instance.
Key Notes
- Make sure your CM and Identity Server instances are up and running
- Package your items before you run the synchronization. The initial content synchronization overrides your changes.
- Take the latest every time and push the content changes into your local instance. This way you can keep your local instance updated.
- Enable watch before you start making any changes
- Please do not check-in your local items that are not in use or not needed for any other developers. For example, the sample items that you have created for exploring something.
- Double check the sitecore definition items before you check-in.
Sitecore Reference Links :
Issue Links:
Happy Sitecoreing 😊












