We provide two ways to copy a package from one repository to another:
- Copy via the API using tools/integrations (such as the Cloudsmith CLI)
- Copy via the Website UI.
To copy a package using the Cloudsmith CLI, you first need to identify the package. See Package Identification for full instructions on identifying packages.
Once you have identified the package, you use the
cloudsmith copy command to copy it:
cloudsmith copy OWNER/SOURCE_REPO/UNIQUE_ID DESTINATION_REPO
cloudsmith copy demo/examples-repo/IGgZrwGFAkyU examples-repo-public
In the above example, we identified that the package we wished to copy had the Unique ID "IGgZrwGFAkyU", and we copied it from the source repository "examples-repo" to the destination repository "examples-repo-public":
The example below would move all packages defined by the
-q query from
YOUR-DEST-REPO (note that the destination is NOT qualified by a
YOUR-ACCOUNT namespace - This is because you can only copy/move packages from repositories in the same account, and not across accounts yet).
cloudsmith ls pkg OWNER/SOURCE_REPO -q 'YOUR-QUERY'/ -F json | jq '.data | .namespace + "/" + .repository + "/" + .slug' -r / | xargs -Ipackage cloudsmith copy package DESTINATION_REPO
-q query you can use any terms that you would use when searching for a package (see Search / Filter Packages for full details). For example:
-q 'format:maven AND name:cloudsmith-api AND version:^0.21'
This query would target all Maven packages named cloudsmith-api with version 0.21.*
You can remove the query to target all packages. The only downside to this approach is that it might require multiple invocations if you have more than the page size limit.
You can copy a package using the Website UI:
- Via the repository packages list
- Via the package detail page
To copy a package via the Repository packages list click the orange "Tool" button, then click "Copy"
To copy a package via the package details page, click the blue "copy" button on the right of the package name:
After clicking a "copy" button you will be presented with the Copy Package form. Select the destination repository from the drop-down menu and click "Copy" to complete the package copy:
You will then get an on-screen message confirming that the package copy was successful.
To copy more than one package to another repository, use the checkboxes beside the package names and then click the blue "copy package" button that appears at the top of the package list:
If you have selected a checkbox beside a package name, then package operations under the orange 'tool' button will be disabled as you are now in bulk operation mode.
Updated 8 months ago