在我的公司github中获得本地仓库的权限被拒绝的错误,我可以成功克隆该错误,但是在NPM安装中却出现错误:
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\bin\git.EXE ls-remote -h -t git@<repo path and name>
npm ERR!
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.
npm ERR!
npm ERR! exited with error code: 128
最佳答案
您是说您的库已发布到npm注册表中,还是要使用npm直接从github安装?听起来您正在尝试执行npm install company-org/repo-name
。如果是这样的话,那么您很有可能会尝试让npm从私有(private)仓库中撤出。您可以克隆,因为您可能已经为git设置了SSH key 以用于通过Github进行身份验证。
Double check that SSH is setup,然后在package.json中使用以下语法:
"package-name": "git+ssh://git@github.com:<company-org>/<repo>.git"
(请注意在company-org之前使用冒号而不是斜杠)