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

sha*_*lya 5 git jenkins

我正在尝试在 jenkins 中运行多分支工作。代码放在git中。在运行作业时,我遇到访问权限问题。在生成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.
Run Code Online (Sandbox Code Playgroud)

cow*_*tor 0

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

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

您也可以随时生成一个新密钥并尝试该密钥。