“Host key verification failed” error when running GitHub Actions on self-hosted runner (Windows 10)

huangapple go评论77阅读模式
英文:

"Host key verification failed" error when running GitHub Actions on self-hosted runner (Windows 10)

问题

我正在尝试在我的自托管运行器(Windows 10)上运行一个简单的GitHub Action,但是我收到了错误消息Host key verification failed. [error]fatal: Could not read from remote repository. 这是GitHub Action的代码:

name: GitHub Actions Demo
on:
  push:
    branches: ["feature"]
jobs:
  build:
    runs-on: self-hosted
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3

我已经验证了自托管运行器的配置,并且它已经正确连接到了仓库,我可以在同一台机器上手动克隆和获取仓库的内容,没有任何问题。我也尝试过运行ssh-keyscan命令,并将生成的主机密钥添加到known_hosts文件中,但是问题仍然没有解决。

英文:

I'm trying to run a simple GitHub Action on my self-hosted runner (Windows 10), but I'm getting the error Host key verification failed. [error]fatal: Could not read from remote repository. Here's the code for the GitHub Action:

name: GitHub Actions Demo
on:
  push:
    branches: ["feature"]
jobs:
  build:
    runs-on: self-hosted
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3

I've verified that the self-hosted runner is properly configured and connected to the repository, and I can manually clone and fetch the repository on the same machine without any issues. I've also tried running the ssh-keyscan command and adding the resulting host key to the known_hosts file, but that doesn't solve the problem.

答案1

得分: 2

不要运行直接的检出操作,首先尝试运行以下命令以测试SSH访问:

steps:
  - name: Test SSH access
    run: ssh -Tv git@github.com

这是为了查看哪个密钥正在通信,以及在您手动测试时(当克隆/提取正常工作时)使用的帐户是否与您相同。

OP ysief-001 随后在评论中看到了以下内容:

经过1小时30分钟,我取消了工作流程。
最后两行是

Found key in C:\\Users\\ysief/.ssh/known_hosts:4
read_passphrase: can't open /dev/tty: No such file or directory

这只是意味着受密码保护(即加密)的私钥不受支持。
您需要一个没有密码的私钥。(或者您可以从现有密钥中删除密码

英文:

Instead of running directly the checkout action, try first running a

    steps:
      - name: Test SSH access
        run: ssh -Tv git@github.com

The is to see which key is communicated, and it the account used is the same as the one you are with, when you do your manual test (when the clone/fetch is working).

The OP ysief-001 then sees (in the comments)

> After 1h30m I cancelled the workflow.
The last two lines are
>
> Found key in C:\Users\ysief/.ssh/known_hosts:4
> read_passphrase: can't open /dev/tty: No such file or directory

That simply means a passphrase-protect (IE: encrypted) private key is not supported.
You need one without passphrase. (Or you can remove the passphrase from your existing key)

huangapple
  • 本文由 发表于 2023年2月16日 15:41:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75469148.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定