Site Creation with Remote Repositories

Crafter Studio supports site creation with remote repositories and provides two options:

  • Create site based on remote Git repository
  • Create site based on a blueprint then push to remote bare Git repository

To start creating a site with remote repository, from the Sites screen, click on the Create Site button. A Create Site dialog will be launched. In the Create Site dialog, click on Link to upstream remote Git repository

System Administrator - Create Site "Link to upstream remote Git repository"

Once the link is expanded, as mentioned above, there are two options provided for site creation with remote repositories. For each option, the Remote Git Repository Name and Remote Git Repository URL needs to be filled out and the rest is optional and only needs to be filled out if required by the remote git repository being used.

Let’s take a look at the fields displayed when Link to upstream remote Git repository is expanded.

System Administrator - Expanded "Link to upstream remote Git repository" fields
  1. In the Remote Git Repository Name field you want to provide a repository name that makes sense. It’s common to use “origin” or “upstream.”

  2. In the Remote Git Repository URL field you must provide the link to the Git repository you would like to use

  3. In the Remote Branch field, you can supply a branch name, but can be left blank, which in turn would default to the master branch.

  4. In the Authentication field you must select the authentication method to be used to access the Git repository in the previous field.

    Crafter CMS supports the following authentication types to use to access remote repository:

    • None - no credentials needed to access remote repository
    • Basic - for this method, you will be asked for a Remote Git Repository Username and a Remote Git Repository Password. Supply your username and password
    • Remote Git Repository Token - for this method, you will be asked for a Remote Git Repository Username (if required) and a Remote Git Repository Token. This method is usually used when two-factor authentication is configured on the remote repository to be accessed. Supply your username if required and token.
    • Remote Git Repository Private Key - for this method, you will be asked for a Remote Git Repository Private Key. This method is a key-based authentication. Supply your private key.
  5. In Options, select the option for the operation required, Create site based on remote Git repository or Create site based on a blueprint then push to remote bare git repository

    The field Blueprint is available when the option Create site based on a blueprint then push to remote bare Git repository is selected. Choose one of the default or choose your own. The available default blueprints are as follows: Empty, Headless_blog, Headless_store and Website_editorial

Note

When using ssh keys for authentication, the keys need to be generated using RSA as the algorithm and with no passphrase.

To generate your Secure Shell (SSH) keys for authentication, run the following command ssh-keygen -b 4096 -t rsa. Your output should look something like this:

✗ ssh-keygen -b 4096 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/myuser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/myuser/.ssh/id_rsa.
Your public key has been saved in /Users/myuser/.ssh/id_rsa.pub.
.
.

After generating your private and public keys, you will need to add your new public key to where your remote git repository is located. If you are using GitHub, you will need to add your public key (e.g., id_rsa.pub) into your GitHub account. If your remote Git repository is hosted on a server, you will need to copy your public key (e.g., id_rsa.pub) to the host server.

After copying your public keys to where your remote git repository is located, there are a couple of ways to setup the way Crafter Studio accesses the remote repository:

  1. Set the authentication type to Remote Git Repository Private Key in the Create Site screen, then specify your private key in the Remote Git Repository Private Key field.
  2. Set the authentication type to None in the Create Site screen, if you put the key in the default RSA key path in the Crafter Studio server (~/.ssh/id_rsa). Remember the key needs to use the default filename (id_rsa and id_rsa.pub) when using this method of setting up access to the remote repository.

Create site based on a blueprint then push to remote bare Git repository

To create a site based on a blueprint then push to a remote bare Git repository, fill in the required items once Link to upstream remote Git repository has been expanded:

System Administrator - Create Site based on a blueprint then push to remote Git repository"

Click on the Create button, your site should be created in a short while, and then pushed on to the remote bare Git repository specified in the field Remote Git Repository URL. Remember that the remote repository needs to be a bare git repository, otherwise the site creation will fail.

Create site based on a remote Git repository

Creating a site based on a remote Git repository is basically exporting a site from one Studio and importing it into another one.

To create a site based on remote Git repository, fill in the required items once Link to upstream remote Git repository has been expanded. The Remote Git Respository URL is the import site’s sandbox repository git url (the site you want to bring over to your Studio). Below are sample urls for the site being imported:

Here is a sample Git url from GitHub: https://github.com/username/hello-test.git Here is a sample Git url using ssh: ssh://[user@]host.xz[:port]/path/to/repo/ or alternatively for ssh: [user@]host.xz:path/to/repo/

System Administrator - Create Site based on remote Git repository

Under Options, select Create site based on remote Git repository, then click on the Create button. After a short while, your site will be imported.

In case you want to publish the entire site, follow these optional steps:

  1. In the site you just imported, click on siteConfig, then click on Publishing

    System Administrator - Bulk Publishing"
  2. In the Publishing screen, click on the Bulk Publish tab, and in the Path to Publish field, just enter /, then click on the Publish button to publish the whole site.

    System Administrator - Bulk Publish the whole site filled in"