How do I duplicate a repository configuration on another server?

It is unnecessary for you to go through the whole manual creation process when generating duplicate repositories on a new server. You can use our REST API from the command line to quickly set-up your new repositories using commands similar to the following:


First, get the repository configuration from the first server and store it in a file:

 

curl -X GET ‘http://my.artifactory.server1/artifactory/api/repositories/my-snapshot-local’ -u user:password > file.json


Second, use the file that you just created to generate the repository on the destination server. (You can change the name from ‘my-snapshot-local’ to something else, provided that you edit the ‘key’ property in ‘file.json’ to reflect the name change.)

 

curl -X PUT ‘http://my.artifactory.server2/artifactory/api/repositories/my-snapshot-local’ -d @file.json -H ‘Content-Type: application/json’ -u user:password


Of course you’ll want to replace the ‘my.artifactory.server*/artifactory’, in each command depending on your server locations and configurations.  Also, you’ll need to provide valid user/password credentials, unless you have the anonymous user configured to allow anonymous access to this functionality, in which case you can skip the ‘-u’ flag/info.