简体   繁体   English

使用https协议在package.json中使用私有git repo进行npm安装时出现权限错误

[英]Permission error to use private git repo in package.json for npm install using https protocol

I'm using this url in package.json in dependancies using https 我使用https在依赖关系中在package.json中使用此URL

<private repo>:"git+https://<token>:x-oauth-basic@github.com/<org>/<private repo>"

Also I have tried with this one 我也尝试过这个

<private repo>:"git+https://<token>:x-oauth-basic@github.com/<org>/<private repo>.git"

add only .git at the end 最后只添加.git

And I know token is valid Becz 而且我知道令牌是有效的Becz

When I'm cloning this repo using this below command on terminal working fine 当我在终端上使用以下命令克隆此仓库时工作正常

git clone https://<token>:x-oauth-basic@github.com/<org>/<private repo>.git

So I'm getting error like this even though I'm not use ssh protocole 所以即使我不使用ssh协议,也会出现这样的错误

 npm ERR! Permission denied (publickey).
 npm ERR! fatal: Could not read from remote repository.
 npm ERR!
 npm ERR! Please make sure you have the correct access rights
 npm ERR! and the repository exists.

And I've created this token by selecting scopes read:org,write:org 我通过选择范围read:org,write:org创建了该令牌

Check your version of NPM (npm -v). 检查您的NPM版本(npm -v)。 There is a bug in NPM 2.7.4 (and maybe 2.7.5) that causes cloning of private repos to fail. NPM 2.7.4(也许是2.7.5)中存在一个错误,该错误会导致私有存储库的克隆失败。

See: https://github.com/nodejs/node/issues/1323 参见: https : //github.com/nodejs/node/issues/1323

I ran into this today with 2.7.4 installed. 今天,我遇到了安装2.7.4的问题。 I updated to the latest nodejs which brought down NPM 2.11.3, and I was able to get a private repo over git+https with token just fine. 我更新到了最新的nodejs,它降低了NPM 2.11.3的性能,并且能够通过git + https获得带有令牌的私有仓库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自私有 github 仓库的 npm 包,安装 vs 更新 (package.json) - npm package from private github repo, install vs update (package.json) NPM安装:package.json中的Git URL依赖性错误 - NPM install : Git URL dependency error in package.json npm安装没有package.json的git存储库 - npm install git repository without package.json 使用npm,如何在全球范围内安装和使用私有存储库中的“二进制”软件包? - Using npm, how do I globally install and use a “binary” package from a private repo? 从git repo运行软件包的&#39;npm install&#39;时出错 - Error when running 'npm install' for a package from a git repo npm install没有读取package.json - npm install not reading package.json 尝试使用git协议克隆存储库会导致https错误? - Trying to clone a repo using git protocol leads to https error? NPM 安装/更新:无需使用 Git 存储库更改 package.json 即可获取最新版本 - NPM install/update: Getting the latest version without having to alter package.json with Git repository npm 错误。 尝试安装 package.json 时 git dep 准备失败 - npm ERR! git dep preparation failed when trying to install package.json 使用Jenkins时,如何使用package.json从某个分支中提取私有git存储库? - How can I use the package.json to pull private git-repository from a certain branch when using Jenkins?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM