JuliaHub has the ability to create private registries

Private registries require JuliaHub Team or Enterprise.

To create a private registry navigate to the Admin (settings icon) at the bottom of the left menu bar and select settings.

admin settings

Now you will need to select credentials to add the new PAT (Personal Access Token).

credentials

If you don’t already have a Personal Access Token, you’ll need to visit GitHub to create one. Once you visit log-in to your github account.

github

After successful login you will see a home page and navigate to your profile by clicking on the image at top right and in the menu select settings.

github settings

Once you have selected settings menu you will be able to see a menu at the left, scroll down to the bottom and select “Developer Settings” in the menu

developer settings

After that select Personal Access Token(PAT) and click on “Generate new token” and this will generate a new token.

pat

Select classic token then add the necessary details including the Token name or why it will be used, expiration period and the access and click “Generate token” and this will generate a new PAT token. After the token is generated save the token value in your computer as you will not be able to see it again.

new token

Once done navigate back to JuliaHub settings credentials to add this token. Click on the “+” icon to add a new token and write the ID which is the token name and Value which is the token that was generated, and add star “*” in URL Prefix section then scroll down and click on the “Update” button.

token added

After all the above steps are done now we will create a new registry for that navigate to “Registries” in the administrator settings and click on the “+” sign to create a new registry. Provide the details as the registry name you want to create. In the example below I have used

Registry UUID: 029dca29-6cbd-4fff-82a3-f7236bdedde2 (Generate this with UUID generator)
Registry URL: https://github.com/snehshah74/AdminDemoRegistry
Registry Owner: admin
Git Server Type: Github
Add the Git Credentials

Note: To generate UUID visit UUID Tools

From the options select create registry and all the other options if required and add the primary email address associated with github account.

new registy

And click on update and it will create a new registry. To verify if the new registy is created, navigate to the Registry URL and a git repository will be automatically created with the Registry.toml file.

git verification

GitHub apps integration

You can setup GitHub registries on JuliaHub using GitHub app integrations instead of Personal access tokens. To know more about GitHub app integrations in general, see these pages in the GitHub documentation.

GitHub app id

Once you have created a GitHub app, note the "App ID" as shown above.

GitHub app private key

Scroll down on the same page and generate a private key and store the private key securely.

GitHub app permissions

Switch to the "Permissions and Events" tab to set the app permissions. Select "Read and Write" permissions for each of "Issues", "Pull Requests" and "Contents".

GitHub app issues permissionGitHub app pull requests permissionGitHub app contents permission

Don't forget to click "Save changes" after setting the permissions.

GitHub app save changes

Now switch to the "Install App" tab and install this app on your registry and any private packages that you wish to register into the registry in the future. Note that package registrations for private packages will not work unless the GitHub app is installed on both the registry and the private package repositories.

Set the GitHub app as credential on JuliaHub

GitHub app credentials on JuliaHub

Navigate to Admin->Settings->Credentials on JuliaHub. Scroll to the bottom of the page where you will find the "GitHub Apps" section. Enter the App ID of your GitHub app, upload the private key file and set the "URL Prefix" for your GitHub app. You can set https://github.com or a more specific organization prefix for the "URL Prefix" input but please note that the URL Prefix is only indicative in this case and does not function as a secure access control list.

Use the GitHub app credential for your registry

Navigate to "Registries" and select the registry that you want to modify to use GitHub app credentials or create a new registry.

GitHub app registry settings

GitHub apps are only supported on GitHub hosted registries. The option "Credentials Type" will appear for such registries as shown above. If this is set to "Personal Access Token", change it to "GitHub app" by clicking on the radio button. Now select the App ID of your GitHub app in the dropdown. Click "Update" when you are done. Package synchronization via GitHub App credentials should be operational now.

GitHub app registrator setup

If you have enabled Registrator for this registry, open the "Registrator" tab and click on "Update" so that the Registrator configuration is regenerated to include the GitHub App credential. Package registrations via GitHub App credentials should be operational now.

Availability of the package version on JuliaHub package server

JuliaHub will try syncing versions of the packages every 30 minutes. Please check JuliaHub Packages page to check whether the version is available for download.

Organization settings

Organization settings on GitHub can sometimes restrict third party OAuth applications like the JuliaHub Registrator from accessing private repositories. See Managing OAuth access to your organization's data.

registrator restrictions

Using a Registry from JuliaHub

To use a custom registry on your local machine, you will need to download an authentication token from the platform.

Adding the JuliaHub registry

Start a Julia session and install the PkgAuthentication package. This package can be used for both initial setup and to stay connected to the registry.

using Pkg
Pkg.add("PkgAuthentication")

Next, configure Julia to be aware of http://juliahub.com's package server:

using PkgAuthentication
PkgAuthentication.install("juliahub.com")

Then add all known registries on https://juliahub.com, including the JuliaHub registry, using the command:

Pkg.Registry.add()
Note

The command above will only work on Julia v1.8 and later. On versions prior to v1.8 use the pkg> REPL command registry add instead.

This will open up a new browser window or tab and ask you to sign in to https://juliahub.com or to confirm authenticating as an already logged in user.

JuliaHub Authentication when not logged inJuliaHub Authentication when logged in

Once logged in, the browser tab can be closed. Julia will be authenticated with the package server at https://juliahub.com and download all available registries.

Note

This will also change the package server to https://juliahub.com for all Julia sessions that run startup.jl.

Staying connected to the JuliaHub registry

The authentication token will expire after a while, so it is convenient to enable an automatic mechanism for renewal. This can be achieved using the previously installed PkgAuthentication package, by adding the following snippet to your local <home directory>/.julia/config/startup.jl file.

Base.eval(Module(), quote
    using PkgAuthentication
    PkgAuthentication.install("juliahub.com")
end)

This will ensure that whenever a Pkg operation is performed that an up-to-date authentication token is available either silently or through another browser interaction.