Publishing and Consuming GitHub Package Repository with NuGet: Unable to load the service index error

前端 未结 1 1133
野趣味
野趣味 2021-02-15 15:00

I\'m trying to push and then consume a NuGet package using GitHub packages (documentation here). As a newcomer, after experimenting a bit I managed to push a sample NuGet packag

相关标签:
1条回答
  • 2021-02-15 15:57

    The documentation for pushing NuGet packages to Github is outdated. The steps that worked for me:

    • Go to GitHub
      • Click your avatar (top-right)
      • Settings
      • Developer settings
      • Personal access tokens
      • Generate
        • write:packages
        • read:packages
        • delete:packages
        • This will automatically check the repo permissions for your OAuth token
      • Click Generate token
    • Open cmd
      • Navigate to your project directory or the directory containing your NuGet package
      • Add a new nuget source:
        • dotnet nuget add source --username [GithubUserName] --password [YourApiKey] --name github https://nuget.pkg.github.com/[UsernameOrOrganizationName]/index.json
      • Push the package to the github source
        • dotnet nuget push --source github bin\Release\MyAwesomePackage.1.0.0.nupkg

    Verify that the Github API key is not stored inside a Nuget.config file inside your solution before committing your code to source control.

    0 讨论(0)
提交回复
热议问题