How to Rename a Repository

How to Rename a Repository

AuthorFullName__c
Daniel Poterman
articleNumber
000004993
ft:sourceType
Salesforce
FirstPublishedDate
2021-02-02T09:49:54Z
lastModifiedDate
2021-02-02
VersionNumber
6

Although it’s technically possible to rename a repository, we highly recommend that you do not attempt to do so, as it will typically result in unpredictable and decidedly undesirable behavior (e.g., broken links, loss of artifacts, etc.). 

An alternative solution is to create a new repository with the name that you desire, making sure that it has the same configuration as the repository that you were otherwise thinking to rename.  Thereafter, move all the contents from your old repository to your new one. Note: As Artifactory is checksum storage-based, this will not be a costly procedure.

Here’s the step-by-step process:
1. Run the Repository Configuration REST API to obtain and place into a JSON file the full configuration of your old repository:

curl -X GET -u<USER_NAME>:<PASSWORD> “https://localhost:8081/artifactory/api/repositories/<oldRepoKey>” > repository-config.json
2. In the JSON file, change the key value to the name of your new repository.
3. Run the Create Repository REST API to create your new repository based on your updated JSON file:
curl -X PUT -H "Content-Type:application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json" "https://localhost:8081/artifactory/api/repositories/<NewRepoKey>" -u<USER_NAME>:<PASSWORD> -d@repository-config.json
4. Move all the contents from your old repository to your new one using the UI or a Move Item REST API:
curl -X POST -u<USER_NAME>:<PASSWORD> "https://localhost:8081/artifactory/api/move/<oldRepoKey>?to=/<newRepoKey>"