Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Authentication SSH访问Github:shell好的,Jenkins失败了_Authentication_Github_Jenkins - Fatal编程技术网

Authentication SSH访问Github:shell好的,Jenkins失败了

Authentication SSH访问Github:shell好的,Jenkins失败了,authentication,github,jenkins,Authentication,Github,Jenkins,在您立即将此标记为可能的副本之前,请阅读全文 TLDR: 我正在尝试设置一个jenkins来读取一个私有Github存储库。当我将jenkins凭据与用户名/密码一起使用时,它可以工作;当我将jenkins凭据与私钥一起使用时,它不能工作,并且我得到了一个“无效用户名/密码”错误 详细说明: 我在ApacheTomcat8上安装了jenkins 2.5,jenkins在用户tomcat8下运行。还安装了凭据插件(2.1.4)、Git客户端插件(1.19.6)、Gitplugin(2.5.2)、G

在您立即将此标记为可能的副本之前,请阅读全文

TLDR: 我正在尝试设置一个jenkins来读取一个私有Github存储库。当我将jenkins凭据与
用户名/密码一起使用时,它可以工作;当我将jenkins凭据与
私钥一起使用时,它不能工作,并且我得到了一个“无效用户名/密码”错误

详细说明:

  • 我在ApacheTomcat8上安装了jenkins 2.5,jenkins在用户
    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版中运行
  • 我已经为用户tomcat8[通过
    sudo-su-tomcat8以tomcat8身份登录]创建了一个密码为空的ssh密钥对
  • 我已将公钥添加到私有Github存储库中
  • 我已经创建了一个jenkins credentials
    ssh用户名,其中包含全局作用域的私钥、用户名
    tomcat8
    、空密码和完整私钥,从
    ----开始RSA私钥------
    ----结束RSA私钥------
  • 我用github帐户的普通用户名和密码创建了一个jenkins creditals“username/password”
  • 当我登录到用户
    tomcat8
    并使用命令
    ssh-T通过shell检查github身份验证时git@github.com
    我得到了正确的输出。这意味着我对github使用密钥进行的身份验证有效(对吗?)

    tomcat8@ci:~/.ssh$ssh-Tgit@github.com 嗨,github用户名!您已成功通过身份验证,但GitHub不提供shell访问

  • Wenn我现在设置jenkins作业:
    存储库URL:https://github.com/repoownername/reponame.git
    并使用用户名/passwort凭证即可访问。但是当我使用ssh凭据时,身份验证失败

    无法连接到存储库:命令“git-c core.askpass=true ls remote-h HEAD”返回状态代码128: 标准: stderr:remote:无效的用户名或密码。 致命:验证“”失败

    进一步资料 当我使用用户名/密码凭据运行构建时

    git config remote.origin1.url#timeout=10 从中获取上游更改 使用.gitcredentials设置凭据 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+refs/heads/:refs/remotes/origin1/ git config--本地--删除节凭据#超时=10

    当我使用SSH凭据时,我得到了上面提到的错误

    因此,我现在的问题是:如何成功地使用SSH凭据而不是用户名/密码

    我查看的一些教程:


      • 哦,老兄,我有点傻

        我的错误是使用了错误的存储库URL!我曾经用过:

        https://github.com/repoownername/reponame.git
        使用
        用户名/密码
        凭据时,该选项可以正常工作

        但是对于SSH访问,我必须使用


        git@github.com:repoownername/reponame.git

        已经为此挣扎了3个小时,并使用https链接,试图使SSH密钥正常工作。