Skip to content

Internal Packages

Internally developed R and Python packages belong in Package Manager, not in a shared directory or a remotes::install_github() call in someone's script. Package Manager gives them versions, an activity log, and the same install path as CRAN packages.

Two kinds of sources hold internal packages:12

Source type How packages arrive Best for
git (R) / git-python (Python) Package Manager clones a repository and builds on new commits or tags Actively developed packages
local (R) / local-python (Python) An admin uploads built tarballs or wheels Vendor packages, frozen releases, packages from systems Package Manager cannot reach

R packages use the git and local source types; Python packages use the separate git-python and local-python source types. The CLI commands below use the R names; swap in the -python source type and add --name (required for Python git-builders) to build Python packages instead.12

Git builders

Create a source and a repository, then attach builders:

rspm create source --name=internal-git --type=git
rspm create repo --name=internal --description='Internal packages'
rspm subscribe --repo=internal --source=internal-git

Build on tags (recommended: each release is an explicit, reviewable event):

rspm create git-builder --url=https://git.example.com/team/mypackage.git --source=internal-git --build-trigger=tags

Build on every commit to a branch (useful for development repos; commits is the default trigger):1

rspm create git-builder --url=https://git.example.com/team/mypackage.git --source=internal-git --build-trigger=commits --branch=main

Branch builds get versions like 1.1-3.0.0.0.1537204599 (the package's own version plus a .0.0.0.<commit-timestamp> suffix) so every commit is unique. Tag builds keep the version from the package's DESCRIPTION file, and the tag name must match or closely resemble it (for example 5.4.2 or v5.4.2).1

Private repositories

Private repositories need a credential, imported once and referenced by name:

rspm import ssh-key --name=git-deploy-key --path=/root/.ssh/ppm_deploy_key
rspm import https-credential --name=git-pat --username=svc-ppm --password=<TOKEN>
rspm create git-builder --url=git@git.example.com:team/mypackage.git --source=internal-git --build-trigger=tags --credential=git-deploy-key

Package Manager also supports GitHub App credentials and OAuth2 federated credentials for Azure DevOps and Bitbucket, which avoid long lived tokens.1 To avoid secrets in shell history, encrypt values first with rspm encrypt and pass the result to --password or --passphrase-path.3

Build status and requirements

Inspect builds:

rspm list git-builders --source=internal-git
rspm list git-builds --source=internal-git --name=mypackage

Building Git packages requires R (and Python for Python packages) on the Package Manager host, set by Server.RVersion and Server.PythonVersion.4 Builds happen in Server.TempDir/rspm-workspaces. If you change the service account, change the owner of that directory too.5

Walkthrough: a package from GitHub Enterprise

This section follows one internal R package from a private GitHub Enterprise repository to an install.packages() call. Every step runs on the Package Manager server, except tagging the release and adding the deploy key in GitHub. The examples use these placeholder names:

Placeholder Meaning
github.example.com Your GitHub Enterprise host
data-science/mypkg The organization and repository that hold the package
mypkg The package name in DESCRIPTION
packagemanager.example.com Your Package Manager address
internal-git, internal The source and repository you create below

The diagram below shows the path. Package Manager checks the repository for new tags and builds each one in a sandbox. The result lands in a repository that Workbench and Connect already read from.

flowchart TD
    Dev(["Developer<br/>pushes tag v1.0.0"]) -->|"i. push"| GHE["GitHub Enterprise<br/>data-science/mypkg"]
    GHE -->|"ii. poll every 5m<br/>(deploy key)"| Builder("git-builder<br/>mypkg")
    Builder -->|"iii. R CMD build<br/>in a sandbox"| Source[("Source<br/>internal-git")]
    Source -->|"iv. subscribed"| Repo[("Repository<br/>internal")]
    Repo -->|"v. install.packages()"| WB("Workbench")
    Repo -->|"v. install.packages()"| Con("Connect")

    style Builder fill:#e8f5ec,stroke:#3f8f5a,stroke-width:2px,color:#1a1a1a
    style Source fill:#e8f5ec,stroke:#3f8f5a,stroke-width:2px,color:#1a1a1a
    style Repo fill:#e8f5ec,stroke:#3f8f5a,stroke-width:2px,color:#1a1a1a
    style WB fill:#e8f1f8,stroke:#447099,stroke-width:2px,color:#1a1a1a
    style Con fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a

Step 1: confirm the server can build R packages

Git builds need R on the server and Linux user namespaces for the sandbox.17 Check the Package Manager log for the R detection message (reading the log may need root):

grep -E 'Detected R version|Unable to use R' /var/log/rstudio/rstudio-pm/rstudio-pm.log

Detected R version means Git builds for R are on. Unable to use R on this system means they are off. Next, check the user namespace limit:

cat /proc/sys/user/max_user_namespaces

A value of 0 disables the sandbox, and Git builds with it. Each build uses two namespaces, so Posit suggests a high limit such as 15000. To raise it, your sudo administrator adds user.max_user_namespaces=15000 to /etc/sysctl.d/files.conf and reboots.7 Do not turn on Git.AllowUnsandboxedGitBuilds to work around a zero; Posit calls that insecure.

Step 2: confirm the server can reach GitHub Enterprise

Package Manager clones over SSH (port 22) or HTTPS (port 443), so the server needs a network path to your GitHub host. Test both ports from the Package Manager server:

curl -sS -o /dev/null -w '%{http_code}\n' https://github.example.com
timeout 5 bash -c '</dev/tcp/github.example.com/22' && echo "port 22 open"

An HTTP status code (such as 200 or 302) means HTTPS works. If port 22 is blocked, use the HTTPS credential in the next step instead of an SSH key.

Step 3: create a deploy key

A deploy key is an SSH key that grants access to a single repository, and GitHub makes it read only unless you allow writes.9 Package Manager only clones, so read only access is all it needs. Generate the key in a private directory on the server:

umask 077
mkdir -p ~/ppm-keys
ssh-keygen -t ed25519 -C "package-manager mypkg" -f ~/ppm-keys/mypkg

Posit recommends a passphrase.1 Enter one at the prompt, then save it to a file for the import:

printf '%s' '<passphrase>' > ~/ppm-keys/mypkg.passphrase

In GitHub Enterprise, open the repository's Settings, then Deploy keys, then Add deploy key. Paste the contents of ~/ppm-keys/mypkg.pub and leave Allow write access unchecked.

GitHub does not let one deploy key serve two repositories,9 so each package repository gets its own key. If SSH is blocked, create a personal access token with read access to the repository's contents. Then import it with rspm import https-credential (see Git builders).

Step 4: import the key into Package Manager

rspm runs on the server as root or as a member of the rstudio-pm group. Import the private key and its passphrase under a name you will reuse:

rspm import ssh-key --name=ghe-mypkg --path=$HOME/ppm-keys/mypkg --passphrase-path=$HOME/ppm-keys/mypkg.passphrase

Package Manager stores the key encrypted in its database, so the files are no longer needed.1 Delete them, and confirm the credential name is listed:

rm -rf ~/ppm-keys
rspm list git-credentials

Step 5: create the source and repository

The source holds the packages that builders produce. A repository publishes them to users. Skip this step if internal-git and internal already exist:

rspm create source --name=internal-git --type=git
rspm create repo --name=internal --description='Internal packages'
rspm subscribe --repo=internal --source=internal-git

Step 6: tag a release

With a tag trigger, each release is an explicit event that someone reviewed. Package Manager builds a tag only when it matches the Version field in DESCRIPTION, either 1.0.0 or v1.0.0 for Version: 1.0.0.1 In a clone of the package repository, tag the commit and push the tag:

git tag v1.0.0
git push origin v1.0.0

Step 7: create the git-builder

The builder ties the repository, the credential, and the source together. Use the SSH form of the clone URL:

rspm create git-builder \
  --url=git@github.example.com:data-science/mypkg.git \
  --source=internal-git \
  --credential=ghe-mypkg \
  --build-trigger=tags

The command waits for the first builds and prints their results.8 The builder name defaults to the package name from DESCRIPTION. Add --sub-dir if the package is not at the top of the repository.

Step 8: verify the build

List the builds for the package. Each row shows a transaction ID, the tag, and a status:

rspm list git-builds --source=internal-git --name=mypkg

If a build failed, pass its transaction ID to rspm logs to see the R output:

rspm logs --transaction-id=<transaction id>

A successful build also appears in the internal repository's Activity Log in the web interface. Confirm that R sees the package from Workbench or any client:

available.packages(repos = "https://packagemanager.example.com/internal/latest")["mypkg", "Version"]
install.packages("mypkg", repos = "https://packagemanager.example.com/internal/latest")

Step 9: release the next version

New releases need no work on the server. Bump Version in DESCRIPTION, commit, then tag and push the new version:

git tag v1.1.0
git push origin v1.1.0

Package Manager checks for new tags every Git.PollInterval (default 5m), so the new version appears within a few minutes.4

When a build does not appear

Most failures trace back to the tag, the credential, or the network. Work through these in order:

  • Tag does not match: the tag must match Version in DESCRIPTION. Fix the version, then push a new tag. Or rebuild an existing tag with rspm rerun git-builder --name=mypkg --source=internal-git --tag=v1.0.0.1
  • Retries used up: Package Manager retries a failed build three times, then skips that tag. Fix the cause and run rspm rerun.1
  • Clone fails: turn on debug logging with rspm config log --level=DEBUG, then read the Git and SSH messages in rstudio-pm.log.1 Turn it back to the normal level when you finish.
  • Host refused: from 2026.09.0, Git.AllowedHost limits which hosts builders can clone from. If it is set, it must include github.example.com.4

Limit clone hosts

Set Git.AllowedHost to your GitHub Enterprise host so builders cannot clone from anywhere else. Posit notes that anyone who can create a builder can spend any stored credential against any clone URL.1

[Git]
AllowedHost = github.example.com

Local uploads

rspm create source --name=internal-local --type=local
rspm subscribe --repo=internal --source=internal-local
R CMD build /path/to/mypackage
rspm add --source=internal-local --path=/path/to/mypackage_1.0.0.tar.gz

Python wheels and source distributions go into a local-python source in the same way.2

Your own binaries

For internal packages with compiled code, upload binaries next to the source package so users skip compilation:

R CMD INSTALL --build mypackage_1.0.0.tar.gz
rspm add binary --source=internal-local --distribution=rhel9 --path=/path/to/mypackage_1.0.0_R_x86_64-pc-linux-gnu.tar.gz

The --distribution flag must name the distribution the binary was built for.6 Use tag based Git builders if you plan to upload binaries for Git packages; commit based versions have timestamp suffixes that make matching hard.

Using internal packages

Clients add the internal repository alongside CRAN:

options(repos = c(
  CRAN = "https://packagemanager.example.com/cran/__linux__/rhel9/latest",
  Internal = "https://packagemanager.example.com/internal/__linux__/rhel9/latest"
))

On Connect, add an [RPackageRepository "Internal"] block. If the public facing tier needs internal packages, create the internal repository on the DMZ Package Manager too. The other option is to let the DMZ Connect reach the internal one.

Comparing repositories across servers

During migrations, compare the repositories two Package Manager instances publish with posit-pm --compare:

posit-pm --compare https://ppm-old.example.com