我需要通过对故宫的登录凭据在脚本中有没有办法让类似的git凭证的凭证:
git clone https://username:[email protected]
看看在.npmrc file您可以使用此文件来设置NPM配置变量,如证书,注册表中的位置,等等。这个文件位于你的主目录。下面是用于参考的例子.npmrc文件:
.npmrc
〜/ .npmrc
registry=https://registry.npmjs.com/ _auth="<token>" email=<email> always-auth=true
替换您的电子邮件,并适当_auth token为您的凭据。你的脚本将使用.npmrc文件中设置这些全局配置。
希望帮助!
我发现了一个NPM包,这在几个月前,但我忘了更新这个问题。
只要安装npm-cli-login并在终端/脚本中使用它,如下:
npm-cli-login -u testUser -p testPass -e [email protected]