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:
Generic
NPM
Maven
Python
Go
NuGet
Cargo
Dart
Composer
Conda
RPM
Push generic files of any type.Usage
hc artifact push generic <registry-name> <file-path> [flags]
Options
Name of the file being uploaded (defaults to actual filename)
File path within the package (defaults to filename)
Description of the artifact
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
Push NPM packages (.tgz).Usage
hc artifact push npm <registry-name> <npm-tgz-path> [flags]
Options
Base URL for the Packages API
Package Requirements
- Must be a
.tgz or .tar.gz file
- Must contain a valid
package.json in the tarball
- Package name and version are extracted from
package.json
Examples
hc artifact push npm npm-registry ./my-package-1.0.0.tgz \
--pkg-url https://app.harness.io
# Using glob pattern
hc artifact push npm npm-registry ./*.tgz \
--pkg-url https://app.harness.io
Process
- Validates the tarball format
- Extracts and parses
package.json
- Builds NPM upload payload
- Uploads to registry
Push Maven artifacts (.jar, .war).Usage
hc artifact push maven <registry-name> <file-path> [flags]
Options
Path to the POM file (.xml or .pom)
Base URL for the Packages API
Package Requirements
- Package must be
.jar or .war file
- POM file must be
.xml or .pom
- Package and POM must have matching coordinates (groupId, artifactId, version)
- SNAPSHOT versions are not currently supported
Examples
hc artifact push maven maven-registry ./myapp-1.0.0.jar \
--pom-file ./pom.xml \
--pkg-url https://app.harness.io
hc artifact push maven maven-registry ./webapp-2.1.0.war \
--pom-file ./pom.xml \
--pkg-url https://app.harness.io
Process
- Validates Maven coordinates from both package and POM
- Generates MD5 and SHA1 checksums
- Uploads package, POM, and checksum files
- Updates or creates
maven-metadata.xml
The command automatically handles checksum generation and maven-metadata.xml updates.
Push Python packages (.whl, .tar.gz).Usage
hc artifact push python <registry-name> <file-or-folder-path> [flags]
Options
Base URL for the Packages API
Package Requirements
- Wheel files:
.whl with METADATA in .dist-info/
- Source distributions:
.tar.gz with PKG-INFO
- Must contain valid Name and Version metadata
Examples
# Push single wheel file
hc artifact push python pypi-registry ./mypackage-1.0.0-py3-none-any.whl \
--pkg-url https://app.harness.io
# Push entire dist folder
hc artifact push python pypi-registry ./dist \
--pkg-url https://app.harness.io
# Push source distribution
hc artifact push python pypi-registry ./mypackage-1.0.0.tar.gz \
--pkg-url https://app.harness.io
Folder Upload
When providing a folder path:
- Scans for all
.whl and .tar.gz files
- Skips subdirectories
- Uploads each package individually
- Shows progress for each file
Push Go modules.Usage
hc artifact push go <registry-name> <folder-path> [flags]
Options
Version for the Go package
Base URL for the Packages API
Package Requirements
- Folder must contain valid Go module files
- Must have
go.mod file
- Version must follow semantic versioning
Examples
hc artifact push go go-registry ./mymodule \
--version v1.2.3 \
--pkg-url https://app.harness.io
Process
- Generates
.mod, .info, and .zip files
- Creates multipart form with all three files
- Uploads to registry
The command automatically generates the required Go module artifacts from your source code.
Push NuGet packages (.nupkg).Usage
hc artifact push nuget <registry-name> <file-path> [flags]
Options
Nested directory path within the registry
Base URL for the Packages API
Package Requirements
- Must be
.nupkg file
- Must contain valid NuGet package metadata
Examples
hc artifact push nuget nuget-registry ./MyPackage.1.0.0.nupkg \
--pkg-url https://app.harness.io
# Push to nested path
hc artifact push nuget nuget-registry ./MyPackage.1.0.0.nupkg \
--path myorg/packages \
--pkg-url https://app.harness.io
# Using glob pattern
hc artifact push nuget nuget-registry ./*.nupkg \
--pkg-url https://app.harness.io
Push Rust Cargo packages (.crate).Usage
hc artifact push cargo <registry-name> <file-path> [flags]
Options
Base URL for the Packages API
Package Requirements
- Must be
.crate file
- Must contain valid
Cargo.toml with package name and version
Examples
hc artifact push cargo cargo-registry ./mypackage-1.0.0.crate \
--pkg-url https://app.harness.io
# Using glob pattern
hc artifact push cargo cargo-registry ./*.crate \
--pkg-url https://app.harness.io
Process
- Extracts metadata from Cargo.toml
- Creates Cargo-specific upload payload
- Uploads with proper binary format
Push Dart/Flutter packages (.tar.gz).Usage
hc artifact push dart <registry-name> <dart-tar-gz-path> [flags]
Options
Base URL for the Packages API
Package Requirements
- Must be
.tar.gz or .tgz file
- Must contain valid
pubspec.yaml
- Package name and version extracted from pubspec.yaml
Examples
hc artifact push dart dart-registry ./mypackage-1.0.0.tar.gz \
--pkg-url https://app.harness.io
# Using glob pattern
hc artifact push dart dart-registry ./*.tar.gz \
--pkg-url https://app.harness.io
Process
- Extracts and validates pubspec.yaml
- Creates multipart upload with unique ID
- Streams package content to registry
Push PHP Composer packages.Usage
hc artifact push composer <registry-name> <file-path> [flags]
Options
Base URL for the Packages API
Package Requirements
- Must contain valid
composer.json
- Package name and version required in metadata
Push Conda packages.Usage
hc artifact push conda <registry-name> <file-path> [flags]
Options
Base URL for the Packages API
Push RPM packages.Usage
hc artifact push rpm <registry-name> <file-path> [flags]
Options
Base URL for the Packages API
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
Coordinate mismatch (Maven)
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