NPM安装错误本地回购权限被拒绝(publickey)

获取权限拒绝在我的公司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 

你是说你的lib发布到npmregistry,还是你想用npm直接从github安装? 这听起来像你正在尝试执行npm install company-org/repo-name 。 如果是这样,那么你很可能试图让npm从私人回购拉。 你可以克隆,因为你可能已经设置了一个SSH密钥供git用来validationGithub。

仔细检查SSH是否已安装 ,然后在package.json中使用以下语法:

 "package-name": "git+ssh://git@github.com:<company-org>/<repo>.git" 

(注意在公司组织之前使用冒号而不是斜线)