Hex v0.20.0 mix hex.repo View Source

Manages the list of available Hex repositories.

The repository is where packages and the registry of packages is stored. You can fetch packages from multiple different repositories and packages can depend on packages from other repositories. To use a package from another repository than the global default hexpm add repo: "my_repo" to the dependency declaration in mix.exs:

{:plug, "~> 1.0", repo: "my_repo"}

By default all dependencies of plug will also be fetched from my_repo unless plug has declared otherwise in its dependency definition.

To use packages from my_repo you need to add it to your configuration first. You do that by calling mix hex.repo add my_repo https://myrepo.example.com.

The default repo is called hexpm and points to https://repo.hex.pm. This can be overridden by using mix hex.repo set ....

A repository configured from an organization will have hexpm: prefixed to its name. To depend on packages from an organization add repo: "hexpm:my_organization" to the dependency declaration or simply organization: "my_organization".

To configure organizations, see the hex.organization task.

Add a repo

mix hex.repo add NAME URL

Command line options

  • --public-key PATH - Path to public key used to verify the registry (optional).
  • --auth-key KEY - Key used to authenticate HTTP requests to repository (optional).

Set config for repo

mix hex.repo set NAME --url URL
mix hex.repo set NAME --public-key PATH
mix hex.repo set NAME --auth-key KEY

Remove repo

mix hex.repo remove NAME

Show repo config

mix hex.repo show NAME

List all repos

mix hex.repo list