在您立即将此标记为可能的副本之前,请阅读全文。
TLDR:我正在尝试设置一个jenkins来读取一个私有的 Github存储库。当我在username/password
中使用jenkins凭据时,它会起作用;当我将jenkins凭据与一个private key
一起使用时,它不会工作,而且我会得到一个“无效用户名/或密码”错误。
详细说明:
tomcat8
下运行。还安装了凭据插件(2.1.4)、Git客户端插件(1.19.6)、Gitplugin (2.5.2)、Gitplugin API插件(1.76)、Github插件(1.19.2)、SSH凭据插件(1.12)。Git正在2.1.4版本中运行sudo -su tomcat8
登录为tomcat8提供了空密码。ssh username with private key
、空密码和从-----BEGIN RSA PRIVATE KEY-----
到-----END RSA PRIVATE KEY-----
的完整私钥的jenkins凭据tomcat8
并通过ssh -T git@github.com
命令检查github身份验证时,我会得到正确的输出。这意味着我使用github的密钥进行身份验证(对吗?)
tomcat8 8@ci:~/. ssh $ssh -T git@github.com Hi github-用户名!您已经成功地通过了身份验证,但是GitHub不提供shell访问。Wenn我现在设置我的jenkins作业:repository URL: https://github.com/repoownername/reponame.git
并使用用户名/密码-凭证,访问是可以的。但是,当我使用ssh-凭据时,身份验证失败了。
无法连接到存储库:命令"git -c core.askpass=true ls-remote -h https://github.com/repoownername/reponame.git HEAD“返回状态代码128: stdout: stderr: remote:无效用户名或密码。致命:“https://github.com/repoownername/reponame.git”的身份验证失败
使用用户名/密码凭据运行生成时的进一步信息
从--file=/tmp/tomcat8-tomcat8-tmp/git1018128562913260002.credentials获取上游更改的git配置--本地credential.username github-用户名# timeout=10 git配置-本地credential.helper商店- timeout=10 git -c core.askpass=true提取-标记-进度https://github.com/repoownername/reponame.git +ref/heads/:refs/remotes/1/ git配置-本地-删除-区域凭证# timeout=10
当我使用SSH凭据时,我会得到上面提到的错误。
所以我现在的问题是:,我如何才能成功地使用SSH-凭据而不是用户名/密码?
我查过的一些教程:
发布于 2016-07-12 17:38:49
哦,天哪,我是个傻瓜。
我的错误是我使用了我的存储库的错误URL!我用过:
https://github.com/repoownername/reponame.git
,它在使用username/password
凭据时工作得很好。
但对于SSH-Acess,我不得不用
git@github.com:repoownername/reponame.git
https://stackoverflow.com/questions/38334124
复制相似问题