jenkins - 詹金斯共享库:权限被拒绝(公钥)
问题描述
我尝试在jenkins中动态加载一个共享库,托管在github上,如下所示
library identifier: 'custom-lib@master', retriever: modernSCM(
[$class: 'GitSCMSource',
remote: 'ssh://git@github.com:papanito/jenkins-pipeline-helper.git',
credentialsId: 'git'])
但是,这失败并出现以下错误
hudson.plugins.git.GitException: Command "git ls-remote -h -t git@github.com:papanito/jenkins-pipeline-helper.git" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
我正在使用的凭据具有有效的私钥,并且当我通过 Jenkins 设置使用该库时可以正常工作。但是,在管道中动态加载它不起作用。任何线索为什么?
解决方案
只需将您的密钥移动到文件夹中并授予文件夹 chmod 600 级访问权限。然后从该文件夹中添加密钥。SSH-add 应该适合你。
推荐阅读
- asp.net - 无法通过 http post 将 JSON post 数据发送到 asms web 服务
- c# - Rijandeal 和特殊字符
- android - Flutter Page 每次在导航弹出时都会重新加载
- c++ - MNIST:获得的准确度比我在互联网上看到的结果要低
- java - 包含 & <> 符号的 Jaxb 解组 xml
- mysql - 日期过滤器之间的 Laravel 搜索
- swift - iOS Swift:如何从我的文档目录文件创建 .zip 文件
- ios - 在颜色变化时选择颜色(在滑动色轮上)
- java - Spring boot PUT 操作正在对 DB 中的所有列进行查询
- spring - Spring Data Jpa:关于创建和更新时间戳(MySQL)