Error "Unable to load the service index for source" while trying to publish a NuGet package to gitlab.com

I have private C# project on gitlab.com and want to create a NuGet package.

I followed the instruction and created the following Nuget.config file on the solution level.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <packageSources>
 <clear />
 <add key="gitlab" value="https://gitlab.com/api/v4/project/{my_project_id_here}/packages/nuget/index.json" />
 </packageSources>
 <packageSourceCredentials>
 <gitlab>
     <add key="Username" value="vadim.loboda" />
     <add key="ClearTextPassword" value="{my_personal_token_with_api_ access_here}" />
 </gitlab>
 </packageSourceCredentials>
</configuration> 

Then I used the Visual Studio Package Manager Console and ran the following command:

dotnet nuget push "C:\{path_to_the_package_here}\MyProject.1.0.0.nupkg" --source gitlab

and had the following error:

error: Unable to load the service index for source https://gitlab.com/api/v4/project/{my_project_id_here}/packages/nuget/index.json.
error:   Response status code does not indicate success: 404 (Not Found).

MyProject.1.0.0.nupkg — exists.
Nuget.config — is seen by the command (reflects changes in the file).
Personal Token — I played with different permissions, at least api permission is granted, and all others too.

What is wrong in my actions and how to create a NuGet package from the C# project on GitLab.com?

2 Likes

create a deployment token and deploy username, i found this works for username and cleartextpassword

1 Like