Symptoms:
- My storage consumption is too high, and I need to reduce it without losing content.
- I want to have a copy of the repository managed by me.
- I want to share an offline copy of a repository.
Cause:
Although Unity Version Control has its own backup system in case of failure of the server, those backups are not available to the users. In these cases, a user may want to have a local copy of a repo, or they may want to remove content from the server without losing it forever.
Resolution:
What would be needed first is to create a local copy of the repository, as explained here.
Create a backup:
Once you have the local copy of all the repositories you want to sync, you can follow these steps to save a copy of the repository:
- Open the command line console.
- Run a "cm repo list yourserver --format=TABLE" command. This will show a list of all the repositories and the number associated with them.
- Go to the local server binaries folder (where it was installed) and look for the jet folder there.
- Inside the folder, you will see some "rep_XX" folders. Copy the one you want to back up.
- If you wanted to remove content from the server, now it would be safe to do it, as you could recover it from the folder you backed up.
C:\Users\heber>cm repo list localhost:8087 --format=TABLE 1 default localhost:8087 2 Test localhost:8087 4 DemoRepoLocal localhost:8087 5 ALocalProject localhost:8087
Restore a backup:
Once you have it backed up, you may want to recover those backups. Here are the steps to do it:
- Copy the "rep_XX" folder to the jet folder in the server binaries location.
- Open the command line console.
- Run the "cm repo add rep_XX reponame server:port" command.
- If you wanted to recover it to a cloud server, you would now need to sync the newly added repo on the local server with the cloud one.
That should be enough to have the backup version back online.
Additional notes:
Keep in mind that any cm command you run has a built-in guide that can be accessed by adding the "--help" flag to the command.
You could use any desired tool to run incremental backups.
The rep_XX folders correspond to the database of each of your repositories. It contains the data and the metadata for them. The number matches what the repo list command has shown.