Multiple repositories on the same cloud storage service but with different accounts

Below are step-by-step instructions for setting up two repositories, each of which backs up to a different account of the same cloud storage (Google Drive in this case).

Run the init command in folder1:

cd path/to/folder1
duplicacy init -storage-name gcd1 folder1 gcd://storage1

folder1 will be backed up to the storage1 directory in your Google Drive account. The -storage-name option is important here, because Duplicacy manages credentials by the storage name, and you need to give each repository a unique storage name in order to separate its credentials from others.

The generated preferences file will look like this:

{
  "name": "gcd1",
  "id": "folder1",
  "storage": "gcd://storage1",
  ...
}

Duplicacy will then ask you for the path to the token file used to access the first Google Drive account. On macOS and Windows, Duplicacy will save the token file path automatically, but you can also set up this environment variable to avoid the need to enter the token file path:

export DUPLICACY_GCD1_GCD_TOKEN=/path/to/tokenfile1

You can also run the set command to save the token file path in the preferences file:

duplicacy set -key gcd_token -value /path/to/tokenfile1

Run the init command in folder2:

cd path/to/folder2
duplicacy init -storage-name gcd2 folder2 gcd://storage2

Note that we use a different storage name than gcd1. Therefore, Duplicacy will not retrieve the token file path saved by the init command in step 1. Instead, it will ask you for the path to a token file again, and you can supply with the one that is authorized to access your second Google Drive account.

The generated preferences file will look like this:

{
  "name": "gcd2",
  "id": "folder2",
  "storage": "gcd://storage2",
  ...
}

To reference the second token file, set up a different environment variable with gcd2 in the name:

export DUPLICACY_GCD2_GCD_TOKEN=/path/to/tokenfile2

If you use the set command instead, note that the key will be the same:

duplicacy set -key gcd_token -value /path/to/tokenfile2

This is because the set command writes the key/value pair to the preferences file, which is per repository, so there won’t be any conflict here.

To perform the backup of folder1 use the command:

cd /path/to/folder1; duplicacy backup -storage gcd1

To perform the backup of folder2 use the command:

cd /path/to/folder2; duplicacy backup -storage gcd1

It it sure, it is gcd1 for repo folder2 ?

Should’t it be

cd /path/to/folder2; duplicacy backup -storage gcd**2**

Thanks for pointing this out. I will check the steps again and fix if necessary later this week.