I have an issue with adding repository in powershell with
Register-PSRepository -name gitlab -PublishLocation https://gitlab.private.com/api/v4/projects/3280491/packages/nuget/index.json -SourceLocation https://gitlab.private.com/api/v4/projects/3280491/packages/nuget/index.json -InstallationPolicy Trusted -Credential (Get-Credential) -PackageManagementProvider NuGet
credential user: my gitlab username, password: my generated access token with api privilege.
If then i will want to query modules inside: find-module -Repository gitlab WARNING: Query Url https://gitlab.private.com/api/v4/projects/2797/packages/nuget/index.json is invalid. it throws me this error.
I have tried the same with my account on gitlab.com with a free account. And i have the same issue. There is no issue if i will create a project that is available to everyone. This happens if project is internal/private.
If i will use nuget , then i have no issue with publishing my module to gitlab / private gitlab, i have no issue with doing nuget install ... . Any idea why this would not work with powershell cmdlets ? I am not sure if i understood some messages i found on internet about issues with powershellget, as if it would have issues with storing credentials. Maybe someone seen this issue, and understands it more and could explain ?
I can find the module inside the repository: Find-Module -Repository gitlab -Credential $mycred
Version Name Repository
------- ---- ----------
0.4.2 PrivateAutomation gitlab
But when piped to Install-module it does not work DEBUG: 00:00:01.7085410 Completed downloading 'https://gitlab.private.net/api/v4/projects/97/packages/nuget/metadata/privateautomation/0.4.2.json'. WARNING: An internal error occurred: The JSON object returned by the NuGet API does not match expected schema. Expected property: 'type'. Check the debug stream for the full JSON object dump.
I am running powershell v7.1 / powershellget 2.2.5 Thank you.
GitLab uses nuget v3 endpoint for the repository. v3 is not supported in the current stable version of PowerShellGet, but it is in PowerShellGet 3.0 which is in preview at the time of writing.