加载密钥:权限被拒绝的詹金斯

时间:2019-08-11 07:00:45

标签: git jenkins

我正在尝试在詹金斯从事多部门工作。代码放在git中。在执行任务时,我遇到了访问权限问题。在jenkins中生成ssh-keygen时,出现权限被拒绝错误。

在Ubuntu框中配置。

  1. 尝试从/root/.ssh复制id_rsa和id_rsa.pub,但它不会复制id_rsa中的任何内容,也不允许手动编辑文件。
 git ls-remote -h git@github.com:****/*****1.git HEAD
The authenticity of host 'github.com ("IP Address")' can't be established.
RSA key fingerprint is SHA256:********************Y8.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/var/lib/jenkins/.ssh/known_hosts).
Load key "/var/lib/jenkins/.ssh/id_rsa": Permission denied
Permission denied (publickey).
fatal: Could not read from remote repository.

1 个答案:

答案 0 :(得分:0)

Load key "/var/lib/jenkins/.ssh/id_rsa": Permission denied与读取本地文件系统上的本地ssh私钥有关,与远程服务器无关。

确保您已拥有ssh密钥的读取权限。 (当我的密钥由Windows主机加密但我的Docker容器无法解密时,我遇到了这个问题。)

您还可以始终只生成一个新密钥并尝试使用该密钥。