ARTIFACTORY: How to add an Artifactory NuGet remote repository to resolve a package from nuget.pkg.github.com
In this article, we learn how to configure an Artifactory Nuget remote repository to resolve packages from nuget.pkg.github.com. This configuration helps us to pull the packages available in private/public Github package repositories Via Artifactory. And also please note currently it is not fully supported. We have a few issues with pointing to the public GitHub Nuget feed and resolving the packages which are explained below in more detail.
Please find the steps to configure a remote repository pointing to URL:
https://nuget.pkg.github.com.
Configuring a remote repository:
To configure a remote repository, in the Administrator module, navigate to Repositories | Repositories select the Remote tab, click Add Repository, and select Remote Repository:
Update the following Common Basic Settings:
Repository Key: A mandatory identifier for the repository that must be unique
URL: Github NuGet remote URL: https://nuget.pkg.github.com
User-name: Update the Github Remote Authentication username
Password / Access Token: Update the Github Access token
NuGet v3 Feed URL: https://nuget.pkg.github.com/Keyfactor/index.json
NuGet Download Context Path: Keyfactor/download
NuGet Feed Context Path: Empty.
Configuring the NuGet client:Select the NuGet repository in the Artifacts module Tree Browser, and click Set Me Up to display the code snippets you can use to configure on your NuGet client to use the selected repository to resolve artifacts and configure with the V3 feed.
<configuration> <packageSources> <add key="Artifactory" value="http://artifactory.com/artifactory/api/nuget/v3/nuget-remote/index.json" /> </packageSources> <packageSourceCredentials> <Artifactory> <add key="Username" value="....." /> <add key="Password" value="....." /> </Artifactory> </packageSourceCredentials> </configuration>
Installing the package:Make sure that your nuget.config is pointing to the correct Artifactory instance and try to install the NuGet packages.
nuget install -verbosity detailed Keyfactor.Orchestrators.Common -Version 3.2.0 -Source Artifactory
However please note we have the following issues with GitHub Nuget remote registries for which respective JIRA has been raised.
1. RTFACT-30271- Install the latest Nuget package that doesn't work with Remote upstream "nuget.pkg.github.com" via Artifactory. For example, if we do not mention the specific version while installing it will fail to download as unable to find the package and result in 404 error code response.
2. RTFACT-30270- In case there is a dependency needed as part of the main package installation which is outside the Github registry. And if you create a virtual repository aggregating other remote repositories along with the github registry (nuget.org and Github feed "nuget.pkg.github.com") it will fail to resolve Nuget dependencies.