Skip to main content

Synopsis

Pulls artifacts from Harness Artifact Registry to your local system. Currently supports generic package types with more package types coming soon.
hc artifact pull <package-type> <registry-name> <package-path> <destination-path> [flags]

Supported Package Types

Pull generic artifacts from the registry.

Usage

hc artifact pull generic <registry-name> <package-path> <destination-path> [flags]

Arguments

registry-name
string
required
Name of the registry containing the artifact
package-path
string
required
Path to the package in format: <package-name>/<version>/<filename>
destination-path
string
required
Local path where the file will be saved (directory or file path)

Options

--pkg-url
string
required
Base URL for the Packages API

Examples

# Pull to directory
hc artifact pull generic my-registry app-config/1.0.0/config.json ./downloads \
  --pkg-url https://app.harness.io
# Pull to specific file path
hc artifact pull generic my-registry release-bundle/2.1.0/archive.zip ./my-archive.zip \
  --pkg-url https://app.harness.io
# Pull from nested package path
hc artifact pull generic my-registry libs/common/1.0.0/library.jar ./lib/ \
  --pkg-url https://app.harness.io

Behavior

Destination is a Directory

  • If destination exists and is a directory, file is saved inside it
  • Uses filename from Content-Disposition header or package path
  • Creates directory if it doesn’t exist

Destination is a File Path

  • If destination includes a filename, saves to that exact path
  • Creates parent directories if needed
  • Overwrites existing file

Progress Tracking

The command shows download progress with file size and transfer speed:
Pulling generic file 'config.json' from path 'config.json' (version '1.0.0') in registry 'my-registry'...
config.json [=====>    ] 54% (2.7 MB/5.0 MB) - 1.2 MB/s
Successfully downloaded generic file 'config.json' from path 'config.json' (version '1.0.0') in registry 'my-registry'
Saved to ./downloads/config.json (5242880 bytes)

Output

After successful download, the command displays JSON with details:
{
  "registry": "my-registry",
  "package": "app-config",
  "version": "1.0.0",
  "filename": "config.json",
  "size": "5.00 MB",
  "path": "./downloads/config.json"
}

Package Path Format

The package path follows this structure:
<package-name>/<version>/<filename>
Components:
  • package-name - Name of the package (can include nested paths)
  • version - Version of the package
  • filename - Specific file within the package version
Examples:
app-config/1.0.0/config.json
libs/common/2.1.0/library.jar
releases/v3/3.0.0/release.zip

Error Handling

Error: invalid format: expected '<SRC_REGISTRY>/<ARTIFACT_PATH>/<VERSION>'
Ensure your package path has exactly three parts separated by slashes.
Error: server returned error: 404 Not Found
Verify the package name, version, and filename are correct. Use hc artifact get to check available files.
Error: failed to create destination file: permission denied
Check write permissions on the destination directory or file path.
Error: received empty response from server
The file may be corrupted or not properly uploaded. Try re-uploading the artifact.

Use Cases

hc artifact pull generic config-registry app-config/1.0.0/config.json ./config/ \
  --pkg-url https://app.harness.io
Pull configuration files for deployment or local development.
hc artifact pull generic build-registry myapp/2.1.0/myapp.jar ./artifacts/ \
  --pkg-url https://app.harness.io
Download compiled artifacts for testing or deployment.
hc artifact pull generic release-registry product/3.0.0/release.zip ./releases/ \
  --pkg-url https://app.harness.io
Pull release bundles for distribution.

Tips

List versions first - Use hc artifact get <package-name> to see available versions before pulling.
Content-Disposition header - The actual filename is determined by the Content-Disposition header from the server, which may differ from the path component.
Nested packages - Package names can include slashes (e.g., libs/common). The last slash separates the version.

Coming Soon

Support for additional package types:
  • NPM packages
  • Maven artifacts
  • Python packages
  • Docker images
  • And more

See Also

Build docs developers (and LLMs) love