1

I am trying to configure multiple Nuget source in nuget.config. Nuget.config is added to the root of the project. With same config I can successfully dotnet build my app on my macbook but when I run the same config in linux I get the following error.

/opt/rh/rh-dotnet31/root/usr/lib64/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Unable to load the service index for source https://gitlab.xxxyy.gov/api/v4/projects/id/packages/nuget/index.json [/var/www/folder/member/Member.sln]
/opt/rh/rh-dotnet31/root/usr/lib64/dotnet/sdk/3.1.100/NuGet.targets(123,5): error :   Response status code does not indicate success: 401 (Unauthorized). [/var/www/netcoreapp3.1/member/Member.sln]




<?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <packageSources>
            <clear />
            <add key="gitlab" value="https://gitlab.senate.gov/api/v4/projects/449/packages/nuget/index.json" />
            <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        </packageSources>
        <packageSourceCredentials>
            <gitlab>
                <add key="Username" value="xyz" />
                <add key="ClearTextPassword" value="dhdhdhdh" />
            </gitlab>
        </packageSourceCredentials>
    </configuration>
user557657
  • 856
  • 1
  • 12
  • 35

1 Answers1

0

I figured it out. I had to manually add source nuget source Add -Name "gitlab" -Source "https://gitlandomain/api/v4/projects/id/packages/nuget/index.json" -UserName xyz@domain.com -Password ddhdhdgdgsgv

After this dotnet nuget restore/build works like charm.

user557657
  • 856
  • 1
  • 12
  • 35