Skip to main content

Existing project

Adding a Remote for an Existing Environment

For an existing project, follow the step 3 from the 'New Project' instructions to add your hosting service as a remote repository.

Fetching and Deploying

Perform a fetch from the remote to pull the master branch, ensuring that you have the latest version. You can deploy to the master branch using your preferred Git interface or via the terminal.

If you have removed fields locally, it's crucial to reset the repository on the hosting service before deploying. Refer to the 'Repository Reset' section next to this text for detailed instructions, accessible from the sidebar menu.

Repository Reset (only on non-destructive deployment)

In some hosting plans, non-destructive deployment are used. This means Git deployments overwrite existing files but do not delete them. This can lead to issues, especially with Craft CMS's project configuration files.

Scenario

Consider a scenario where you delete a field locally, removing the corresponding YAML configuration file. When you deploy, the old YAML file remains on the live server because the commit doesn't delete it. Consequently, you might see a "project config out of sync" warning in the control panel.

Do Not Sync: If this occurs, do not click the red banner prompting you to "review project config."

Using the Repo Reset:

Performing a repository reset on the hosting service will clear the server's content (commit history) and start a new history with the deployment you're conducting.

  1. Validate with your hosting provider if there is a way to reset the repository. For the following, we will use Fortrabbit as example.
ssh {your-project}@deploy.us1.frbit.com reset
  1. Afterwards, fetch from your remote to confirm that the commit history has been cleared.
  2. Deploy your project via the terminal with:
git push live <local branch name>:master

Non-Destructive Operation

The reset is non-destructive; your project will continue to operate normally without any interruption.

Deployment Note

For large site deployments, there may be a delay of up to 2-3 minutes before the admin control panel removes the "review project config" notification.