Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.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
Jenkins未能从GitHub获取私人回购_Git_Github_Ssh_Jenkins_Jenkins Plugins - Fatal编程技术网

Jenkins未能从GitHub获取私人回购

Jenkins未能从GitHub获取私人回购,git,github,ssh,jenkins,jenkins-plugins,Git,Github,Ssh,Jenkins,Jenkins Plugins,我已经撞了好几个小时了 这个错误没有改变。记录在案: 我尝试了:loginjenkins在终端中,该命令显示为红色 以jenkins的身份登录时,我可以毫无问题地克隆回购协议 SSH密钥已就位,它们显示在SSH add-l 正确配置了已知\u主机文件 我已经通过ssh将其添加到github.com的known\u hosts 将“存储库URL”替换为公共回购https://github.com/...有效 我拔出了大部分头发,还有一些 我怀疑问题出在哪里? 当我复制~jenkins/.SSH/

我已经撞了好几个小时了

这个错误没有改变。记录在案:

  • 我尝试了:
    loginjenkins
    在终端中,该命令显示为红色
  • 以jenkins的身份登录时,我可以毫无问题地克隆回购协议
  • SSH密钥已就位,它们显示在
    SSH add-l
  • 正确配置了
    已知\u主机
    文件
  • 我已经通过ssh将其添加到github.com的
    known\u hosts
  • 将“存储库URL”替换为公共回购
    https://github.com/...
    有效
  • 我拔出了大部分头发,还有一些
  • 我怀疑问题出在哪里?

    当我复制
    ~jenkins/.SSH/id_rsa.pub
    中生成的SSH密钥时,我注意到密钥末尾的内容是:root@MyComputer不是詹金斯。。。因为我必须使用
    sudossh-keygen
    生成密钥。。。那么糟糕吗

    以下是完整性的构建日志:

    开始b

    y user [8mha:AAAAlh+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgYu/dLi1CL9vNKcHACFIKlWvwAAAA==[0manonymous
    Building in workspace /Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace
    Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace - hudson.remoting.LocalChannel@210aaf84
    Using strategy: Default
    Cloning the remote Git repository
    Cloning repository git@github.com:organization/myRepo.git
    git --version
    git version 1.7.12.4 (Apple Git-37)
    ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:organization/myRepo.git
    [8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=[0mhudson.plugins.git.GitException: Could not clone git@github.com:organization/myRepo.git
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:248)
        at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40)
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012)
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
        at hudson.FilePath.act(FilePath.java:909)
        at hudson.FilePath.act(FilePath.java:882)
        at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
        at hudson.model.Run.execute(Run.java:1604)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:246)
    Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin git@github.com:organization/myRepo.git /Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace" returned status code 128:
    stdout: Cloning into '/Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace'...
    
    stderr: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:873)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:851)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:40)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:246)
        ... 16 more
    Trying next repository
    ERROR: Could not clone repository
    [8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=[0mjava.io.IOException: Could not clone
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1025)
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
        at hudson.FilePath.act(FilePath.java:909)
        at hudson.FilePath.act(FilePath.java:882)
        at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
        at hudson.model.Run.execute(Run.java:1604)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:246)
    Finished: FAILURE
    

    我在OSX上通过将Jenkins startup从LaunchDaemon更改为launchagents解决了这个问题,希望这对您有用。

    这可能也是一个插件问题,正如我发现的那样。我也验证了它,不过,我使用的是https,而不是git协议。如果我跑

    git克隆

    从外壳上看,它可以工作。如果我把它放在Jenkins里面

    Build>executeshell>Command,同样有效。就在我在


    “源代码管理”>“Git”>“存储库URL”框显示它不起作用。

    因此,您创建了SSH密钥,并在GitHub中注册了它,我想您的文件~/.SSH/id\u rsa.pub后面跟着名为~/.SSH/id\u rsa的私钥,对吗?文件
    ~/.ssh/config
    是什么样子的,它看起来像这样吗?您的github帐户有权访问上述私人回购吗?@Havenard我没有配置文件。只有私钥、公钥和已知的主机。关于权限问题,我可以从终端克隆它,这证明它是有效的,对吗?你解决这个问题了吗?我遇到了完全相同的问题。另外,我不知道为什么,但是当我设置Jenkins安全性时SSH坏了,所以我暂时关闭了安全性。等我弄明白了再打给你。