向VSTS包管理进行身份验证 [英] Authenticating to VSTS Package Management

查看:109
本文介绍了向VSTS包管理进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档显示连接到VSTS通过CredentialProvider(提示输入用户名/密码)或通过v2 feed进行软件包管理Feed,将用户名/ PAT保存在nuget.config本身中。

The documentation shows connecting to a VSTS Package Management feed via either a CredentialProvider (which prompts for a username/password), or for a v2 feed saving the username/PAT in the nuget.config itself.

I希望能够在构建时在构建服务器(而非VSTS Build)上传递凭据。是否可以执行此操作而不必手动登录到构建服务器并配置CredentialProvider,或者通过将nuget.config文件中的凭据提交到源代码管理?

I'd like to be able to pass in the credentials at build time on a build server (not VSTS Build). Is there a way to do this without having to manually log in to the build server and configure the CredentialProvider, or by committing the credentials in the nuget.config file to source control?

这既可以用于消费软件包,也可以用于发布新软件包(来自构建的工件)。

This would be both for consuming packages and also for publishing new packages (that are artifacts from the build).

推荐答案

实际上您可以一次将凭据添加到构建服务器,然后可以自动连接到VSTS软件包供稿。

Actually you can add the credential to the build server for once, then you can connect to VSTS package feed automatically.

首次在构建服务器上进行构建,请执行以下操作添加凭据和apikey的命令:

For the first time to build on the build server, execute below commands to add credentials and apikey:

nuget.exe sources Add -Name "feedname" -Source "https://account.pkgs.visualstudio.com/_packaging/feed/nuget/v3/index.json" -username name -password password
nuget.exe setapikey vstskey –source feedname

注意:对于添加的凭据,您可以使用PAT或备用凭据。

Note: for the added credential, you can use PAT or Alternate credentials.

然后您只能通过输入源名称来连接VSTS feed。例如,如果要将nuget包推送到VSTS feed,只需使用以下命令:

Then you can connect with the VSTS feed by inputting the source name only. Such as if you want to push a nuget package to the VSTS feed, just use the command:

nuget.exe push –source feedname –apikey vstskey path/to/name.nupkg

或者您可以添加 nuget.config 文件(具有凭据)进入源代码管理,使用nuget cli时,只需指定 nuget.config 文件的路径即可

Or you can add the nuget.config file (which credentials) into source control, and when use nuget cli, just specify the path of the nuget.config file you used.

这篇关于向VSTS包管理进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆