在 nuget 命令行参数中提供凭据 [英] provide credentials in nuget command line parameters

查看:76
本文介绍了在 nuget 命令行参数中提供凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个托管在 azure 中的 nuget 服务器,它只允许某些人创建包.

We have an nuget server hosted in azure that only allow certain people to create packages.

如果我运行 nuget 命令行,我会被要求提供用户名和密码.是否可以在命令行中提供用户名和密码?

If I run nuget command line, I get asked to provide username and password. Is there a possibility to provide username and password in command line?

我尝试了诸如 -User 或 -UserName 之类的东西,但我得到 Unknown option: '-User'

I tried something such as -User or -UserName, but I get Unknown option: '-User'

nuget push -Source "XXX" -ApiKey VSTS -noninteractive mypackage.*.nupkg -User myUsername

有没有办法从命令行提供凭据?

Is there a way to provide credentials from command line?

推荐答案

您必须更改您使用的 NuGet.config.这可以从 命令行:

You have to change the NuGet.config you use. That is possible from the command line:

nuget sources add -Name "MyExample" -Source "XXX" -username "Y" -password "Z"

密码将加密存储在配置文件中,并且只能在与加密相同的用户上下文中解密.

The password will be stored encrypted in the config file and can only be decrypted in the same user context as it was encrypted.

这篇关于在 nuget 命令行参数中提供凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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