Npm 从linux导入私有存储库
下面的代码可以通过命令Npm 从linux导入私有存储库,npm,npm-install,Npm,Npm Install,下面的代码可以通过命令mpm i在Windows中正常工作 "dependencies": { "my-pack": "git+https://myprivategit.com/my/repo#v0.1.0" }, windows的凭证表单标准已打开,并且已传递登录名和密码 但是在Linux上,会返回一个身份验证错误 npm install npm ERR! Error while executing: npm ERR! /usr/bin/git ls-remote -h -t
mpm i
在Windows中正常工作
"dependencies": {
"my-pack": "git+https://myprivategit.com/my/repo#v0.1.0"
},
windows的凭证表单标准已打开,并且已传递登录名和密码
但是在Linux上,会返回一个身份验证错误
npm install
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://myprivategit.com/my/repo
npm ERR!
npm ERR! remote: HTTP Basic: Access denied
npm ERR! fatal: Authentication failed for 'https://myprivategit.com/my/repo.git/'
npm ERR!
npm ERR! exited with error code: 128
看起来您需要添加凭据,是否可以尝试以下操作:
package.json中为GIT Repo添加前缀,以使用从步骤1生成的访问令牌:
“依赖项”:{
“我的包”:“git+https://:x-oauth-basic@github.com//myprivategit.com/my/repo#v0.1.0“
},
.netrc
,并为其提供登录所需的凭据:
touch ~/.netrc
.netrc:
machine github.com login <token>
machine github.com登录
然后,只需将url保留在您的
.package.json
私有repo中,对我来说,有效的方法是使用存储在.ssh中的ssh密钥进行npm安装
npm安装git+ssh://git@your_git_server.com:your_username/your_private_repo_name.git
我遵循了这一点。netrc解决了这个问题。但是您的答案
machine github.com登录名不完整。这里有更好的解释: