我遵循了所有的指导,以便能够将我的类库的nuget包推送到我的私人GitHub存储库中。
我将以下内容添加到我的csproj中
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PackageId>NextWareProductPortalClientServices</PackageId>
<Version>1.0.1</Version>
<Authors>CodeGenerator</Authors>
<Company>NextWare</Company>
<PackageDescription>This package adds gRPC client library for the NextWare ProductPortal
</PackageDescription>
<RepositoryUrl>https://github.com/NextWareGroup/PPD</RepositoryUrl>
</PropertyGroup>
我将以下nuget.config文件添加到项目的根目录中。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://nuget.pkg.github.com/jkears/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="jkears" />
<add key="ClearTextPassword" value="******6d5a57b7527dfcc646b62ca7d1*****" />
</github>
</packageSourceCredentials>
</configuration>
个人令牌已应用所有权限。
在运行dotnet插件创建包后,我在bin\release文件夹中看到了这个包。然后我尝试运行以下命令...
dotnet nuget push "bin/Release/NextWareProductPortalClientServices.1.0.1.nupkg" --source "github"
输出如下:
warn : No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/jkears'. To save an API Key for a source use the 'setApiKey' command.
Pushing NextWareProductPortalClientServices.1.0.1.nupkg to 'https://nuget.pkg.github.com/jkears'...
PUT https://nuget.pkg.github.com/jkears/
An error was encountered when fetching 'PUT https://nuget.pkg.github.com/jkears/'. The request will now be retried.
An error occurred while sending the request.
The response ended prematurely.
PUT https://nuget.pkg.github.com/jkears/
An error was encountered when fetching 'PUT https://nuget.pkg.github.com/jkears/'. The request will now be retried.
An error occurred while sending the request.
The response ended prematurely.
PUT https://nuget.pkg.github.com/jkears/
error: An error occurred while sending the request.
error: The response ended prematurely.
我已经研究了这个问题,但没有一个报告的修复程序对我有效,包括直接从Nuget CLI运行。
2条答案
按热度按时间aamkag611#
虽然不是答案,但我能够使用以下curl命令推送nuget包。
curl -vX PUT -u“[OwnerName]:[PersonalToken]”-F email protected(https://stackoverflow.com/cdn-cgi/l/email-protection) https://nuget.pkg.github.com/jkears/
我不知道为什么DotNet CLI不工作,但上面的是我所需要的。
goqiplq22#
我也遇到了这个问题,它总是发生在 * 相对较大 * 的软件包(在我的情况下大约3.4MB)。我的结论是这是一个问题与dotnet nuget。奇怪的是,独立的Nuget客户端(在https://www.nuget.org/downloads下载),或者你已经知道的,使用
curl
或HTTP客户端制作PUT请求,这个问题并没有发生。这是成功上传包的
nuget
命令:我报了the issue here。