> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started

`anaconda-repo-cli` is the command-line interface for managing channels, packages, and artifacts on Package Security Manager (On-prem). Use it to script repository operations, integrate with CI/CD pipelines, or work with your repository directly from a shell application.

> [!NOTE]
>
> `anaconda repo` provides a modern replacement for the legacy `conda repo` entrypoint, which is considered deprecated. It uses Anaconda's unified authentication (`anaconda-auth`), to eliminate separate credential configurations and provide a consistent experience across Anaconda tools.

**1. Install the CLI**

> [!WARNING]
>
> `anaconda-repo-cli` is designed as a backwards-compatible replacement for the legacy `conda-repo-cli` package. While the two can be installed simultaneously, installing `anaconda-repo-cli` makes the `conda-repo-cli` package unnecessary. If you have `conda-repo-cli` installed, consider uninstalling it before proceeding:
>
> ```sh theme={null}
> conda remove conda-repo-cli
> ```

1. Install the `anaconda-repo-cli` package by opening Anaconda Prompt (A command-line application included with Windows installations of Anaconda Distribution and Miniconda. Find it by searching 'Anaconda Prompt' in the Windows Start menu.) (Terminal on macOS/Linux) and running the following command:

   ```sh theme={null}
   conda install anaconda-repo-cli
   ```
2. Verify your installation was successful and view which version you've installed:

   ```sh theme={null}
   anaconda repo --version
   ```

**2. Configure the CLI**

Configuring the CLI registers the domain that `anaconda-repo-cli` uses for channels, mirrors, and authentication, and sets it as your default site.

> [!NOTE]
>
> By default, the CLI connects to `anaconda.com`. You can register additional domains (for Package Security Manager (On-prem)) and set any registered domain as the default.

Use `anaconda sites add` to register your deployment's domain. Include `--default` to set the domain as the default:

```sh theme={null}
anaconda sites add --domain <FQDN> --default
```

Replace \<FQDN> with your Package Security Manager (On-prem) deployment's fully qualified domain name.

This writes the site configuration to `~/.anaconda/config.toml` and sets it as the default site. You can verify the result with:

```sh theme={null}
anaconda sites list
```

> [!TIP]
>
> You can also inspect the full configuration for sites:
>
> ```sh theme={null}
> anaconda sites show
> ```
>
> For the full list of `anaconda sites` subcommands, see the [sites command reference](https://anaconda.com/docs/cli-reference/anaconda-auth/commands/sites).

> [accordion] Manual configuration (alternative)
>
> If you prefer to edit the configuration file directly, add the following to `~/.anaconda/config.toml`:
>
> ```toml theme={null}
> default_site = "anaconda-platform"
>
> [sites."anaconda-platform"]
> domain = "<FQDN>"
> ```
>
> Replace \<FQDN> with your Package Security Manager (On-prem) deployment's fully qualified domain name.

**3. Log in to Anaconda with the CLI**

To log in to Anaconda using the CLI, run the following command:

```sh theme={null}
anaconda login
```

> [!NOTE]
>
> Running `anaconda login` opens a browser tab to log you in. Once signed in, close your browser tab and return to your terminal.
>
> ***
>
> If you are using SSO, you will be prompted to log in to your SSO service.

**4. Configure conda to use Package Security Manager (On-prem)**

The CLI comes with a configuration wizard that adds channels from your Package Security Manager (On-prem) organization to your `.condarc`.

> [!TIP]
>
> Before running the wizard, run:
>
> ```sh theme={null}
> anaconda repo channel --list
> ```
>
> This returns a list of channels you own or that have been shared with you through group membership. Consider adding these channels as defaults while running the wizard.

```sh theme={null}
anaconda repo wizard
```

The wizard guides you through adding channels to your `.condarc` file. It shows you channels from your Package Security Manager (On-prem) organization that are available for you to add to your `.condarc`. You *must* set at least one default channel for the wizard to continue.

> [!NOTE]
>
> `anaconda repo wizard` only shows the first 100 channels in your organization by default. If you have more than 100 channels, you can use the `--offset` and `--limit` flags to paginate through your channels.

> [!WARNING]
>
> Misspelled channel names are not accepted. If you enter a channel name that does not match an existing channel, a warning appears and no channel is added.

Your output will look something like this:

```text Example command workflow expandable theme={null}
Conda configuration wizard.
This wizard will configure your CondaRC file using channels from https://<FQDN>.com

The CondaRC path is /Users/<USER>/.condarc

The following channels are available:
Name                           | Mirror | Privacy         | Owners
---------------------------------------------------------------------------
anaconda                       |  ︎ ✔    | public          | anaconda
web_devs                       |  ︎ ✔    | public          | anaconda
snakes                         |  ︎ ✔    | public          | anaconda
data_sci                       |  ︎ ✔    | public          | anaconda

Provide a space-separated list of channels to set as default_channels
It is common to add mirror channels here.
: web_devs snakes data_science 

If you wish to add channels to the "channels" list
provide a space-separated list. You can leave this blank.
: anaconda  
The following Conda configuration will be applied
channel_alias: https://<FQDN>/api/repo
default_channels:
  - web_devs
  - snakes
  - data_sci
channels:
  - defaults
  - anaconda
Confirm changes to /Users/<USER>/.condarc
(The current condarc file will be archived) [Y, n]: y
Backing up your current condarc file to /Users/<USER>/.condarc.backup
```

> [!TIP]
>
> If configuring your `.condarc` with the wizard creates problems, you can revert the changes by running:
>
> ```sh theme={null}
> anaconda repo wizard --restore
> ```

## Basic usage

### Log in to Anaconda

The Anaconda Repo CLI uses the same credentials as the Anaconda CLI. Authenticate once with the Anaconda CLI; the repo commands will then use your stored credentials.

```bash theme={null}
anaconda login
```

After authentication, `anaconda repo` commands use your credentials automatically.

### Check who is logged in

Display information about the currently signed-in user and default channel.

```bash theme={null}
anaconda repo whoami
```

### List your channels

List the channels you own and channels shared with you through group membership.

```bash theme={null}
anaconda repo channel --list
```

## Configuration

Configure the repo CLI using either the `plugin.auth` and site settings in `~/.anaconda/config.toml` (via `anaconda-auth`) or, for legacy setups, the repo client config file.

### Common configuration options

Parameter

Environment Variable

Description

Default

`default_site`

—

Default site to use

—

`url`

—

Repository base URL for Package Security Manager (On-prem)

—

`domain`

`ANACONDA_AUTH_DOMAIN`

Authentication domain (when using anaconda-auth)

`anaconda.com`

### Example configuration for Package Security Manager (On-prem)

For Package Security Manager (On-prem), you can set a default site in `~/.anaconda/config.toml`:

```toml theme={null}
default_site = "psm-on-prem"

[sites."psm-on-prem"]
domain = "your-psm.example.com"
```

### Legacy repo config

When using the legacy `conda repo` entry point, configuration is stored in `~/.conda/repo-cli-config.yaml`. Use `conda repo config` to view or set values.

> [!NOTE]
>
> The `config` command is not available through `anaconda repo`. Use `anaconda sites` to manage site configuration instead.
>
> ***
>
> For Package Security Manager (On-prem) workflows, see [PSM user documentation](https://anaconda.com/docs/psm-on-prem/6.8.0/user/cli.md).
