bis*_*ish 1 authentication github jenkins
在您立即将其标记为可能重复之前,请阅读整篇文章
TLDR:我正在尝试建立一个jenkins来读取私有 Github存储库.当我使用jenkins凭证时username/password
,如果我使用jenkins凭证,private key
它不会,并且我收到"无效的用户名/密码"错误.
详细描述:
tomcat8
.还安装了凭据插件(2.1.4),Git客户端插件(1.19.6),Gitplugin(2.5.2),Github API插件(1.76),GitHub插件(1.19.2),SSH凭证插件(1.12).Git在2.1.4版本中运行sudo -su tomcat8
]ssh username with private key
与全球范围内,用户名tomcat8
,密码为空和满的私钥-----BEGIN RSA PRIVATE KEY-----
来-----END RSA PRIVATE KEY-----
当我登录用户tomcat8
并使用命令通过shell检查github身份验证时,ssh -T git@github.com
我得到了正确的输出.这意味着我使用密钥对github的身份验证工作(对吧?)
tomcat8 @ ci:〜/ .ssh $ ssh -T git@github.com你好github-username!您已成功通过身份验证,但GitHub不提供shell访问权限.
Wenn我现在设置我的jenkins工作:repository URL: https://github.com/repoownername/reponame.git
并使用username/passwort-credential访问很好.但是当我使用ssh-credentials时,身份验证就会失败
无法连接到存储库:命令"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 "的身份验证失败
更多信息当我使用用户名/密码凭据运行构建时
git config remote.origin1.url https://github.com/repoownername/reponame.git#timeout = 10 使用.gitcredentials 从https://github.com/repoownername/reponame.git获取上游更改以设置凭据git config - -local credential.username github-username #timeout = 10 git config --local credential.helper store --file =/tmp/tomcat8-tomcat8-tmp/git1018128562913260002.credentials #timeout = 10 git -c core.askpass = true fetch --tags --progress https://github.com/repoownername/reponame.git + refs/heads/:refs/remotes/origin1 / git config --local --remove-section credential #timetime = 10
当我使用SSH凭据时,我得到上面提到的错误.
所以现在我的问题是:如何成功使用我的SSH凭证而不是用户名/密码
我检查过的一些教程:
噢,我有点傻了.
我的错误是我使用了我的存储库的错误URL!我用过:
https://github.com/repoownername/reponame.git
使用username/password
凭据时工作正常.
但对于SSH-Acess我必须使用
git@github.com:repoownername/reponame.git