Skip to content

rv configure repository

Used to add, update, or remove repositories from the configuration file, while maintaining the file’s formatting and comments.

This command has 5 subcommands for fine tuned repository configuration.

Adds a new repository to the repositories section of the config file.

rv configure repository add <ALIAS> --url <URL> [OPTIONS]
  • ALIAS - the repository alias to add
  • --url <URL> required - the url of the repository to add
  • --force-source - enable force_source for this repository
  • --first — Add as first repository entry
  • --last default - Add as last repository entry
  • --before <alias> - Add before the specified alias
  • --after <alias> - Add after the specified alias

All examples on this page will start with the following configuration:

rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "CRAN", url = "https://cran.r-project.org" },
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-01-01" },
]
Terminal window
rv configure repository add "bioconductor" --url "https://bioconductor.org/packages/3.18/bioc"
OR
rv configure repository add "bioconductor" --url "https://bioconductor.org/packages/3.18/bioc" --last
rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "CRAN", url = "https://cran.r-project.org" },
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-01-01" },
{ alias = "bioconductor", url = "https://bioconductor.org/packages/3.18/bioc" },
]

Add a repository with force_source as the middle repository

Section titled “Add a repository with force_source as the middle repository”
Terminal window
rv configure repository add "bioconductor" --url "https://bioconductor.org/packages/3.18/bioc" --force-source --after CRAN
OR
rv configure repository add "bioconductor" --url "https://bioconductor.org/packages/3.18/bioc" --force-source --before PPM
rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "CRAN", url = "https://cran.r-project.org" },
{ alias = "bioconductor", url = "https://bioconductor.org/packages/3.18/bioc", force_source = true },
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-01-01" },
]

Replace an existing repository entry, keeping the original alias unless otherwise specified.

rv configure repository replace <OLD_ALIAS> --url <URL> [OPTIONS]
  • OLD_ALIAS - the repository alias to replace
  • --url <URL> required - the url of the repository to replace
  • --alias <ALIAS> - new repository alias. Will keep the original alias if not specified.
  • --force-source - enable/disable force_source for this repository

We start with the same configuration file as the first example, then update the CRAN alias to be the latest Posit Package Manager url and enable the force_source option using the following command:

Terminal window
rv configure repository replace CRAN --url "https://packagemanager.posit.co/cran/latest" --force-source
rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "CRAN", url = "https://packagemanager.posit.co/cran/latest", force_source = true },
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-01-01" },
]

Update an existing repository’s fields

Terminal window
rv configure repository update <TARGET_ALIAS> [OPTIONS]
  • TARGET_ALIAS - The alias of the repository to update. Required unless using --match-url
  • --match-url <URL> - Match repository based on the URL instead of the alias
  • --alias <ALIAS> - The new repository alias
  • --url <URL> - The new repository url
  • --force-source - Enable force_source
  • --no-force-source - Disable force_source
Terminal window
rv configure repository update PPM --url "https://packagemanager.posit.co/cran/2025-05-01"
rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "CRAN", url = "https://cran.r-project.org" },
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-05-01" },
]
rv configure repository update --match-url https://cran.r-project.org -- url https://cran.rstudio.com
rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "CRAN", url = "https://cran.rstudio.com" },
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-05-01" },
]

Remove an existing repository

Terminal window
rv configure repository <ALIAS> [OPTIONS]
  • ALIAS - repository alias to remove

We start with the same configuration file as the first example, then to remove CRAN as a repository entry, we will use the following command:

Terminal window
rv configure repository remove CRAN
rproject.toml
[project]
name = "configure"
repositories = [
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-05-01" },
]

Clear all repositories

Terminal window
rv configure repository clear [OPTIONS]

We start with the same configuration file as the first example, then to clear the repositories section, we run the following command:

Terminal window
rv configure repository clear
rproject.toml
[project]
name = "configure"
repositories = []