How to add private nuget package resource in VS Code?

ykl
ykl
284 Points
14 Posts

I'm using VS Code in Ubuntu Linux and I have private github package resource. I'm try to add paclage resource with private token generated from Github (https://docs.github.com/en/enterprise-server@3.9/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).

I'm trying following in CLI terminal:

  1. Execution error:
    dotnet nuget push --source "BackgroundJobs" --api-key anyapikey https://nuget.pkg.github.com/mypackage/index.json
  2. Excuting but resource package not accessable during build
    dotnet nuget add source --username api-key --password <token> --store-password-in-clear-text --name NUGETGitHub "https://nuget.pkg.github.com/mypackage/index.json"
Views: 180
Total Answered: 1
Total Marked As Answer: 1
Posted On: 18-Jan-2024 22:36

Share:   fb twitter linkedin
I think, #2 should be correct command, need to provide correct username and password.
 - Priya  18-Jan-2024 23:46
thanks.
 - ykl  19-Jan-2024 08:02
Answers
ykl
ykl
284 Points
14 Posts
         

Resolved by putting github user id in username in the following. 

dotnet nuget add source --username <github-userid> --password <token> --store-password-in-clear-text --name NUGETGitHub "https://nuget.pkg.github.com/mypackage/index.json"
Posted On: 19-Jan-2024 08:01
Thanks for sharing solution 👍
 - Brian  19-Jan-2024 09:32
 Log In to Chat