【发布时间】:2021-11-24 10:39:55
【问题描述】:
我有一个包含一些测试工作流程的 GitHub 存储库:
name: Tests the App
on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: echo "Testing App."
- run: npm install
- run: echo "Using ESLint."
- run: npm run lint
- run: echo "Testing App."
- run: npm run test
- run: echo "Test completed!"
不幸的是,它抛出了一个退出代码为 128 的 git 错误:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/MYNAME/REPONAME.git
npm ERR! Warning: Permanently added the RSA host key for IP address 'SOMEIPADDR' to the list of known hosts.
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.
[…]
Error: Process completed with exit code 128.
当它尝试 npm install 依赖项时,有一个私有 GitHub 存储库 REPONAME 需要从我的帐户安装。
"dependencies": {
"pckgname": "git+ssh://git@github.com:MYNAME/REPONAME.git#main"
}
在 ci/cd 环境中进行这项工作的最佳方法是什么?
【问题讨论】:
标签: node.js git github npm repository