npm ERR!git@github.com:权限被拒绝(公钥).在GitHub行动



这是我在GitHub操作文件中运行命令npm ci时面临的问题。

Run npm ci
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/------
npm ERR! 
npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.113.4' 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.
npm ERR! 
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-10-19T11_32_39_340Z-debug.log

经过大量研究,我能够弄清楚当你通过Github帐户使用分叉的npm包时,会发生这种情况。在管道中,它试图通过ssh访问。

为此,您需要在Checkout步骤之后的eas-pipeline.yml文件中添加一个额外的步骤。

- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
*******************************************************************************
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/

*******************************************************************************

因为我无法在StackOverflow和StackOverflow上找到任何解决方案,当我们面临任何问题时,StackOverflow是我们的第一选择。所以,我决定把这个答案写在这里。

原始答案:https://github.com/actions/setup-node/issues/214