• Document Up to Date

Remote Repositories

The Remote Repositories under siteConfig allows the user to view remote repositories linked to the site and options to pull and push to the listed remote repositories. It also allows the user to add a remote repository to the site.

Below, we have a site mysweetdotcom with a link to a remote repository in GitHub:

Developer How-Tos - Pushing and Pulling from the Remote Repository

Add a Repository

To add a remote repository for your site, click on the New Repository button. A Create Repository dialog will open where you’ll need to fill in the required information then click on the Create button and you should see the new repository added in the Repositories

Remote Repositories - New Repository :align: center

Note

For more information on errors that a user may encounter when using ssh keys with CrafterCMS, see Debugging SSH Key Issues

Pull from Repository

To get updates from the remote repositories, click on the down arrow next to the remote repository you would like to pull changes from

Remote Repositories - Pull from Remote Repository :align: center

A dialog will open for pulling:

Remote Repositories - Pull from Remote Repository Dialog

You will then be given some options for the merge strategy when Studio pulls from the remote repository by clicking on the dropdown:

Remote Repositories - Pull from Remote Repository Options

  • Accept Ours: Accept the local’s version of the site and overwrite the remote version if different

  • Accept Theirs: Accept the remote’s version of the site and overwrite the local version if different

  • None: Studio will try to merge the remote version with the local version

Conflict Resolution

When performing a pull from remote repository, Git is usually able to merge changes from the remote repository to your local files. Sometimes, a line you edited in a file may have also been edited on the remote repository which will result in a merge conflict when you pull from the remote repository. In this case, you will have to step in and tell Git what to do. Crafter Studio supports resolving the conflict from the Remote Repositories dashboard.

Note

Remember not to use Studio as a git merge and conflict resolution platform. All merge conflicts should be resolved upstream before getting pulled into Studio.

When you perform a pull from repository, and there’s a conflict between your local files and the remote repository files, the message Pull from remote failed will appear:

Remote Repositories - Pull from Remote Repository Error

After closing the error message by clicking the Ok button, you will then be presented with options on how to resolve the conflict

Remote Repositories - Pull from Remote Repository Error Resolution Screen

In the next screen, you will be given the option to cancel the pull operation:

Remote Repositories - Cancel Pull From Remote Repository

You will also be presented with options to resolve the conflict:

  • Accept Remote: accept the changes from the remote repository and discard your local changes

    Remote Repositories - Pull from Remote Repository Conflict Resolution Accept Remote
  • Keep Local: keep your local changes and discard changes from the remote repository

    Remote Repositories - Pull from Remote Repository Conflict Resolution Keep Local
  • Diff: let’s you view the differences between your local files and the files in the remote repository. Crafter Studio let’s you view the differences a couple of ways:

    Remote Repositories - Pull from Remote Repository Conflict Resolution Keep Local

    Remote Repositories - Pull from Remote Repository Conflict Resolution Keep Local

Select the appropriate button for your case, Keep Local or Accept Remote then click on Confirm. You will then be directed to commit the changes done to your local or cancel the pull operation.

Remote Repositories - Pull from Remote Repository Conflict Resolution Keep Local

When committing your changes, you will then be asked to supply a message for the repository history log and you’re done resolving the conflict

Remote Repositories - Pull from Remote Repository Conflict Resolution Keep Local

Push to Repository

To push your changes in Studio to a remote repository, click on the up arrow next to the remote repository you would like to push changes to

Remote Repositories - Push to Remote Repository :align: center

In the Push dialog, select the branch in the remote repository you’d like to push changes to

Remote Repositories - Push to Remote Repository :align: center