问题

Failed to connect to repository : Command "git ls-remote -h git@gitlab.ryana.cn:ryan/helloworld.git HEAD" returned status code 128:
stdout: 
stderr: Host key verification failed. 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解决

一、在 Jenkins 容器内生成 ssh 的认证,执行 ssh-keygen ,然后将生成的 id_rsa.pub(cat ~/.ssh/id_rsa.pub) 添加到 GitHub 的 ssh 认证。然后将 id_rsa (cat ~/.ssh/id_rsa)添加到下图凭证 Private Key 处。

二、主页面 -> 凭据 -> 系统 -> 右击全局凭据 -> 添加凭据,创建一个类型为 SSH Username with private key 用于获取代码的凭据。

jenkins-unrestricted-private-key

三、在拉取代码时候,选取相应的凭证即可。

jenkins-unrestricted-private-key

results matching ""

    No results matching ""