赞
踩
这是我的报错:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git
npm ERR! git@github.com: 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.
这个错误信息表明在尝试通过 SSH 访问 GitHub 时遇到了权限问题。这通常是因为本地计算机没有正确配置 SSH 密钥,或者该密钥没有添加到 GitHub 账户中。解决这个问题的步骤如下:
ls -al ~/.ssh
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
按照提示操作,可以设置密码或者直接按回车键跳过。
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
如果你的密钥文件名不是默认的 id_rsa,请将命令中的 id_rsa 替换为实际的文件名。
cat ~/.ssh/id_rsa.pub
复制输出的内容到 GitHub。
完成这些步骤后,尝试再次运行你的命令。如果问题仍然存在,确认你的 package.json 或相关依赖配置是否正确指向了需要通过 SSH 访问的 Git 仓库。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。