npm install获得模块的权限被拒绝

问题描述 投票:1回答:1

获取权限被拒绝本地仓库的错误,我可以成功克隆,但是npm install:npm install会出错

npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://[email protected]:2222/castor/module-name.git
npm ERR!
npm ERR! [email protected]: 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 ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MOEL3\AppData\Roaming\npm-cache\_logs\2018-03-08T18_12_33_006Z-debug.log

但是,每次我执行关于远程repo pull,push等的git命令时,我都必须输入密码......这是什么原因?如何解决这个问题呢?

node.js git npm-install permission-denied bitbucket-server
1个回答
0
投票

最近遇到这个问题,令人沮丧......

我可以git克隆一个私有仓库没有问题,但是当我试图通过Visual Studio Code安装一个包时,它就会出现类似于身份验证的错误。

[email protected]:权限被拒绝(publickey)。致命:无法从远程存储库读取。请确保您具有正确的访问权限并且存储库存在。

为我修复的是以管理员身份打开Sublime Text,将ssh_config文件放在C:ProgramFiles / Git / etc / ssh /文件夹中,在Admin sublime窗口中打开它,并在底部添加它

HOST github.com
IdentityFile /c/Users/me/.ssh/id_rsa

事实证明,npm install在我的密钥的根文件夹中查找,而不是在主文件夹中。告诉它从我的用户文件夹中的标识中取出密钥解决了这个问题。

希望这可以帮助别人。

© www.soinside.com 2019 - 2024. All rights reserved.