I have a Craft CMS site set up that deploys through TeamCity and am trying to set up a build step to auto run "./craft project-config/sync".

I keep getting an error saying the file can't be found, I've changed the paths a dozen times to try and get it right but no luck. Has anyone had experience with this or able to advise how to set this up?


Got this working with help from Udo's answer. For anyone using TeamCity who would find this useful I'll share my setup for it.

First I deploy the site from a Git VCS root and use the 'SSH Upload' runner type

Then I was trying to set up the sync command through an 'SSH Exec' runner but that didn't seem to work, not sure what the issue was with it so might be able to set it up that way still. The working method is the 'Command Line' runner, set it to run a custom script with the code provided by Udo, ssh {user}@{host} {file_path}/craft project-config/sync the command line is run from the TeamCity agent server not the production server like the SSH Exec runner is meant to.

Additional note to make sure the craft file is executable, if not you will need to do chmod a+x craft


This sounds like the working directory where you are executing the command isn't what you think it is, for example maybe the script is executing the command in / (root) instead of the craft directory.

To run you the project config sync, try adding a step like this to your build setup:


This will remotely run the sync on the live server.

You will need to have ssh keys set up in your build setup for the ssh command to be able to authenticate, and replace the $VARIABLES with your actual values (or define them somewhere in the build setup if that is possible in TeamCity).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.