You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否从GitHub Packages公共仓库使用Install-Module安装PowerShell模块?

问题:无法从GitHub Packages的NuGet仓库获取PowerShell模块

背景

我已成功将自研的PowerShell模块发布至GitHub Packages的NuGet仓库,过程参考了多篇PowerShell相关技术文档。

已完成操作

  • 注册PSRepository:
Register-PSRepository -Name GitHub -SourceLocation https://nuget.pkg.github.com/beau-witter/index.json -PublishLocation https://nuget.pkg.github.com/beau-witter/index.json -InstallationPolicy Trusted
  • 首次执行发布命令成功:
Publish-Module -Path path/to/module -Repository GitHub -NuGetApiKey "<GITHUB_API_KEY>"
  • 重复发布同一版本模块时,收到冲突错误,确认首次发布确实成功:
Write-Error: Failed to publish module 'NetworkAnalyzer': 'nuget.exe failed to push Response status code does not indicate success: 409 (Conflict). '

当前问题

执行Find-Module -Repository GitHub -Credential $BuiltCredentialObject时返回空值,无法获取已发布的模块。GitHub官方文档大多围绕.NET项目和dotnet命令展开,关于PowerShell模块的获取步骤描述模糊;相关NuGet社区问题提到GitHub理论上可作为PSRepository供PowerShellGet命令使用,但内容仅涉及发布流程,未说明如何消费已发布的模块。

疑问

是否真的可以从GitHub Packages的NuGet仓库中获取并使用有效的PowerShell模块?


内容的提问来源于stack exchange,提问作者B. Witter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 13:57:18