5
votes

My project uses a custom feed that I need to authenticate to before using it. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore tells me that --interactive flag should be used. However, that doesn't change anything. I'm getting errors:

/usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Unable to load the service index for source https://myproject.pkgs.visualstudio.com/_packaging/MyFeed/nuget/v3/inde x.json. [/home/xyx/code/MyApp.csproj] /usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Response status code does not indicate success: 401 (Unauthorized). [/home/xyx/code/MyApp.csproj]

How to I authorize to my feed?

1
I believe you want to use dotnet nuget add source: docs.microsoft.com/en-us/dotnet/core/tools/… to set up your username and password. - Peska
I see this allows adding nuget sources. How should I use it if I already have my source added to NuGet.Config? I tried multiple ways, but failed. - Loreno
I do not want to store my credentials in a file that is in git repository - Loreno
Your credentials will be stored in C:\Users\YourName\AppData\Roaming\NuGet\NuGet.Config, not in your git repository. Also your password will be encrypted. This is the way I'm using it. I don't know about any other options. - Peska

1 Answers

6
votes

To make dotnet ask you for credentials, you need to install https://github.com/microsoft/artifacts-credprovider. It solves the problem.