Skip to main content

Synopsis

Pushes artifacts to Harness Artifact Registry. The command supports multiple package types with type-specific subcommands.
hc artifact push <package-type> <registry-name> <file-path> [flags]

Supported Package Types

Select a package type to push:
Push generic files of any type.

Usage

hc artifact push generic <registry-name> <file-path> [flags]

Options

--name
string
required
Name for the artifact
--version
string
default:"1.0.0"
Version for the artifact
--filename
string
Name of the file being uploaded (defaults to actual filename)
--path
string
File path within the package (defaults to filename)
--description
string
Description of the artifact
--pkg-url
string
required
Base URL for the Packages API

Examples

hc artifact push generic my-registry ./config.json \
  --name app-config \
  --version 1.0.0 \
  --pkg-url https://app.harness.io
hc artifact push generic my-registry ./archive.zip \
  --name release-bundle \
  --version 2.1.0 \
  --path releases/archive.zip \
  --pkg-url https://app.harness.io

Common Features

Glob Pattern Support

Many package types support glob patterns for file selection:
# Push all .tgz files
hc artifact push npm npm-registry ./*.tgz --pkg-url https://app.harness.io

# Push all .nupkg files
hc artifact push nuget nuget-registry ./*.nupkg --pkg-url https://app.harness.io

Progress Tracking

All push commands show real-time progress:
Validating input parameters... ✓
Extracting package metadata... ✓
Uploading package to registry... [=====>    ] 54%

Error Handling

Error: failed to validate package file name: unsupported extension: .txt
Ensure you’re pushing the correct file type for the package format.
Error: package.json must contain non-empty 'name' and 'version'
Verify your package contains required metadata files with valid content.
Error: version mismatch: package="1.0.0", pom="1.0.1"
Ensure your POM file matches the package file coordinates exactly.

Best Practices

Always verify your package - Use appropriate package build tools before pushing to ensure metadata is correct.
Use semantic versioning - Follow SemVer (e.g., 1.0.0, 2.1.3) for consistent version management.
SNAPSHOT versions - Maven SNAPSHOT versions are not currently supported via CLI.

See Also

Build docs developers (and LLMs) love