Alternative URLs for one package in a Registry

Can a Registry store multiple (alternative) URLs for the same package? The assumption being that all the URLs have the same content but Pkg should try the next one if one fails.

The motivation is to store both HTTPS and SSH in the repo field, so that a user can access a private package using the authentication method that works for them.

A poor man’s solution is to have two registries, one with HTTPs URLs and another with SSH. But hopefully, there is a better way.

Bonus points if this can be done with LocalRegistry.jl.

No, but see this 4 year old PR: Allow for multiple repo urls in Package.toml by fredrikekre · Pull Request #1060 · JuliaLang/Pkg.jl · GitHub (unlikely to be merged though).

I would suggest you tell Pkg to use system git (set the env variable JULIA_PKG_USE_CLI_GIT to true) and use insteadOf in the git config.

1 Like

At work we work around this issue by serving the private packages with GitHub - GunnarFarneback/LocalPackageServer.jl: Julia storage and package server for local packages.

This works.