错误! git@github.com:权限被拒绝(公钥)。在 GitHub 行动中
npm ERR! git@github.com: Permission denied (publickey). in GitHub Action
这是我在 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 访问。
为此,您需要在 eas-pipeline.yml
文件中的 Checkout
步骤之后添加一个额外的步骤。
- 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/
*******************************************************************************
因为我无法在 Whosebug 上找到任何解决方案,而当我们遇到任何问题时,Whosebug 是我们的第一个去处。所以,我决定在这里写下这个答案。
这是我在 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 访问。
为此,您需要在 eas-pipeline.yml
文件中的 Checkout
步骤之后添加一个额外的步骤。
- 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/
*******************************************************************************
因为我无法在 Whosebug 上找到任何解决方案,而当我们遇到任何问题时,Whosebug 是我们的第一个去处。所以,我决定在这里写下这个答案。