GitRiver GitRiver
RU
Navigation

Package Registry

How to publish and install npm, PyPI, Cargo, Maven, NuGet, and Generic packages in GitRiver

GitRiver has a built-in package registry for 6 popular formats. No separate service is needed - packages are stored alongside your code.

This is a free feature - available in Community without restrictions.

Why

  • Private packages for your team (not published to npm/PyPI)
  • Automatic publishing from CI/CD on every release
  • Unified access through the same tokens as repositories
  • No dependency on external registries

npm

For Node.js projects.

Publishing

Create a .npmrc file in your project:

@owner:registry=https://git.example.com/api/packages/owner/repo/npm
//git.example.com/api/packages/owner/repo/npm:_authToken=YOUR_TOKEN

Then:

npm publish

Installation

npm install @owner/package \
  --registry https://git.example.com/api/packages/owner/repo/npm

Or add to your project’s .npmrc to avoid specifying it every time:

@owner:registry=https://git.example.com/api/packages/owner/repo/npm

PyPI

For Python projects.

Publishing

pip install twine

twine upload dist/* \
  --repository-url https://git.example.com/api/packages/owner/repo/pypi/legacy/ \
  -u __token__ -p YOUR_TOKEN

The login is always __token__, the password is your personal token or deploy token.

Installation

pip install my-package \
  --index-url https://git.example.com/api/packages/owner/repo/pypi/simple

Cargo

For Rust projects.

Setup

Add to ~/.cargo/config.toml (or .cargo/config.toml in your project):

[registries.gitriver]
index = "sparse+https://git.example.com/api/packages/owner/repo/cargo/index/"

Publishing

cargo publish --registry gitriver --token YOUR_TOKEN

Installation

In the dependent project’s Cargo.toml:

[dependencies]
my-lib = { version = "1.0", registry = "gitriver" }

Maven

For Java/Kotlin projects.

Publishing

Add to pom.xml:

<distributionManagement>
  <repository>
    <id>gitriver</id>
    <url>https://git.example.com/api/packages/owner/repo/maven/</url>
  </repository>
</distributionManagement>

And in ~/.m2/settings.xml:

<servers>
  <server>
    <id>gitriver</id>
    <username>your_username</username>
    <password>YOUR_TOKEN</password>
  </server>
</servers>

Then:

mvn deploy

Installation

Add the repository to pom.xml:

<repositories>
  <repository>
    <id>gitriver</id>
    <url>https://git.example.com/api/packages/owner/repo/maven/</url>
  </repository>
</repositories>

NuGet

For .NET projects.

Publishing

dotnet nuget push MyPackage.1.0.0.nupkg \
  --source https://git.example.com/api/packages/owner/repo/nuget \
  --api-key YOUR_TOKEN

Installation

Add a source:

dotnet nuget add source \
  https://git.example.com/api/packages/owner/repo/nuget/ \
  --name gitriver \
  --username your_username \
  --password YOUR_TOKEN

Then:

dotnet add package MyPackage

Generic

For arbitrary files (binaries, archives, documentation).

Upload

curl -T myapp-v1.0.tar.gz \
  -H "Authorization: Bearer YOUR_TOKEN" \
  https://git.example.com/api/packages/owner/repo/generic/myapp/1.0.0/myapp-v1.0.tar.gz

Download

curl -L -O \
  https://git.example.com/api/packages/owner/repo/generic/myapp/1.0.0/myapp-v1.0.tar.gz

Auto-Publishing from CI/CD

Typical scenario: on push of a v* tag, automatically build and publish the package.

name: Release

on:
  push:
    tags: ['v*']

jobs:
  publish:
    image: node:22
    steps:
      - run: |
          echo "//git.example.com/api/packages/$CI_REPOSITORY_OWNER/$CI_REPOSITORY_NAME/npm:_authToken=$CI_JOB_TOKEN" > .npmrc
          npm publish

CI_JOB_TOKEN is automatically available in every CI job and has permissions for the current repository’s registry.


Managing Packages

View, versions, and delete packages: “Packages” tab in the repository.