繁体   English   中英

无法为 Nuget 推送 GitHub Package

[英]Unable to Push GitHub Package for Nuget

我遵循所有指导,以便能够将我的 class 库的 nuget package 推送到我的私人 ZD3B7C913CD04EBFEC 存储库中

我将以下内容添加到我的 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 cli 创建 package 后,我在 bin\release 文件夹中看到了 package。 然后我尝试运行以下命令...

dotnet nuget push "bin/Release/NextWareProductPortalClientServices.1.0.1.nupkg" --source "github"

output如下;

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 运行。

虽然不是答案,但我能够使用以下 curl 命令推送 nuget package。

curl -vX PUT -u "[OwnerName]:[PersonalToken]" -F package=@NextWareProductPortalClientServices.1.0.1.nupkg https://nuget.pkg.github.com/jkears/

我不知道为什么 DotNet CLI 不起作用,但以上就是我所需要的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM