Skip to content

Can't use dotnet add package with a private repository (basic authentication) #5163

Description

@a-h

Details about Problem

  • dotnet --version
    • 1.0.1
  • dotnet
    • 1.1
  • NuGet
    • 3.5.0.1996
  • MacOS Sierra
    • 10.12.4

Steps to reproduce

  1. Create a private NuGet repository (in my case using AppVeyor)
  2. Add it as a source:
nuget sources add -Name xxx -Source https://ci.appveyor.com/nuget/xxx -Username xxx@xxxx.com -Password xxx
  1. Prove that it's possible to list packages:
nuget list -s xxx
Using credentials from config. UserName: xxx@xxx.com
my.nuget.package 1.0.1

4 Attempt to add the private NuGet package to a dotnet project using the CLI:

dotnet add package -s https://ci.appveyor.com/nuget/xxx my.nuget.package

Expected

For the command to add the NuGet package to the project.

Actual

Got a message saying that it couldn't authenticate.

Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.

  Writing /var/folders/v0/gv8rbbt9157g5599sh8qljpr0000gn/T/tmpz9doUg.tmp
info : Adding PackageReference for package 'my.nuget.package' into project '/Users/xxx/Documents/my.nuget.package/src/xxx/xxx.csproj'.
log  : Restoring packages for /Users/xxx/Documents/xxx/src/xxxLibrary/xxx.csproj...
info :   GET https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='my.nuget.package'
info :   Unauthorized https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='my.nuget.package' 4042ms
log  : Retrying 'FindPackagesByIdAsyncCore' for source 'https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='my.nuget.package''.
log  : Response status code does not indicate success: 401 (Unauthorized).
info :   GET https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='my.nuget.package'
info :   Unauthorized https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='xxx' 997ms
log  : Retrying 'FindPackagesByIdAsyncCore' for source 'https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='xxx'.
log  : Response status code does not indicate success: 401 (Unauthorized).
info :   GET https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='my.nuget.package'
info :   Unauthorized https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='xxx' 1007ms
error: Failed to retrieve information about 'my.nuget.package' from remote source 'https://ci.appveyor.com/nuget/xxx/FindPackagesById()?id='my.nuget.package''.
error:   Response status code does not indicate success: 401 (Unauthorized).

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions