对于从公共 GitHub 存储库引用的包,GitHub Pull 请求上的 Npm 安装失败
在package.json
文件中,我添加了一个依赖项,它引用了我们的一个公共存储库。 package.json
中的依赖关系如下:
"ffprobe-static": "git+https://github.com/company-name/repo-name.git",
我可以在本地成功运行npm install
并使用此依赖关系,但是当我按下此代码时,我们的github工作流程在我们执行的位置时npm install
在以下错误中失败:
npm ERR! Warning: Permanently added the RSA host key for IP address 'x.x.x.x' to the list of known hosts.
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.
我不了解此错误的原因,因为我们引用的存储库是公开的,当我本地安装依赖关系时,我也可以访问相同的存储库。
请注意,正在运行此代码的存储库是一个私人存储库,但是引用的存储库是公共的,但在同一组织下。
In the package.json
file, I have added a dependency that is referencing one of our public repositories. The dependency in the package.json
looks like below:
"ffprobe-static": "git+https://github.com/company-name/repo-name.git",
I can successfully run npm install
locally and use this dependency, but when I push this code, our GitHub workflows where we execute npm install
fails with the below error:
npm ERR! Warning: Permanently added the RSA host key for IP address 'x.x.x.x' to the list of known hosts.
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.
I don't understand the reason for this error, since the repository we are referencing is public, and also I can access the same repository when I install dependencies locally.
Note that the repository that is running this code is a private repository, but the referenced repository is public, but under the same organization.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可以通过在 YAML 文件中签出后添加以下步骤来修复它。另外,在结帐步骤中将
persist-credentials
选项设置为 false。I was able to fix it by adding the below step after checkout in the YAML file. Also, set the
persist-credentials
option to false in the checkout step.您可以尝试在 GitHub 工作流程中使用配置强制使用 https URL,至少用于测试:
或者(如 在这里,只是为了说明可以在哪里放置
git config代替
命令):You might try a config to force https URLs, at least for testing, in your GitHub workflow:
Or (as in here, just to illustrate where you can put the
git config insteadOf
command):