如何使用PowerShell模块和NuGet存储库

JFrog支持
2023-01-22 11:07

如果您正在使用NuGet存储库,Artifactory为您提供了使用PowerShell模块的能力。以下是步骤和命令你需要执行这些交互:使用Artifactory:

1.注册在Artifactory中创建的Nuget存储库:

Register-PSRepository -Name "" -SourceLocation "http://< artifactory - ip:/artifactory/api/nuget/" -PublishLocation "http://< artifactory - ip:/artifactory/api/nuget/" -InstallationPolicy受信任

< PS-REPOSITORY-NAME >将为PowerShell客户端创建的存储库名称是什么<存储库名>是Artifactory中NuGet存储库的名称。

2.发布PowerShell模块:

release - module -Path "" -Repository -NuGetApiKey ":"

3.找到模块:

Find-Module -Repository .使用实例

4.下载模块:

Save-Module -Repository -Name -Path

5.如果允许匿名访问(在Artifactory的总体安全配置)是禁用,你可以使用凭据国旗为身份验证添加用户的凭据。例如:

Find-Module -Repository -Credential .使用实例Save-Module -Repository -Name -Path -Credential .使用实例

在执行这些命令(带有凭据标志)之后,系统将提示您输入用户的密码。