Is there a way to rename a repository?

Although it is technically possible to rename a repository, this typically results in unpredictable and very undesirable behavior (broken links, loss of artifacts, etc…). This being said, we highly recommend that you do not attempt to do so. As an alternative solution, you can create a new repository with the name that you desire, and with the same repository configuration as the repository that you wish to rename. Then move all the content from the old repository to the new one (since Artifactory is checksum storage based, this is not a costly procedure).


This can be done as follows:


  1. Run the Repository Configuration REST query, to retrieve the full configuration of the old repository into a .json file:

 

curl -X GET -u<USER_NAME>:<PASSWORD> “http://localhost:8081/artifactory/api/repositories/<oldRepoKey>” > repository-config.json

 

  1. In the created .json file change the “key” value to the name of your new repository.

  1. Create a new repository using the Create or Replace Repository Configuration REST call using the updated .json:

 

curl -X PUT -H "Content-Type:application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json" "http://localhost:8081/artifactory/api/repositories/<NewRepoKey>" -u<USER_NAME>:<PASSWORD> -d@repository-config.json

 

  1. Move all the content from the old repository to the new one using the UI or a Move Item REST call:

 

curl -X POST -u<USER_NAME>:<PASSWORD> "http://localhost:8081/artifactory/api/move/<oldRepoKey>?to=/<newRepoKey>"