无法在linux上将存储库克隆到jenkins

无法在linux上将存储库克隆到jenkins,linux,ubuntu,github,jenkins,jenkins-plugins,Linux,Ubuntu,Github,Jenkins,Jenkins Plugins,我可以克隆我为jenkins上的一个作业创建的存储库。然而,克隆一个存储库(它是另一个存储库的分支)在尝试构建它时会出现以下错误-对可能出现的问题有什么建议吗 Started by user anonymous Building in workspace /var/lib/jenkins/jobs/client1/workspace Checkout:workspace / /var/lib/jenkins/jobs/client1/workspace - hudson.remoting.Loc

我可以克隆我为jenkins上的一个作业创建的存储库。然而,克隆一个存储库(它是另一个存储库的分支)在尝试构建它时会出现以下错误-对可能出现的问题有什么建议吗

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/client1/workspace
Checkout:workspace / /var/lib/jenkins/jobs/client1/workspace - hudson.remoting.LocalChannel@1d5cac4
Using strategy: Default
Cloning the remote Git repository
Cloning repository https://..... (couldn't disclose the address link here)

    git --version
    git version 1.7.9.5
    ERROR: Error cloning remote repo 'origin' : Could not clone https://.....
    hudson.plugins.git.GitException: Could not clone https://......
        at hudson.plugins.git.GitAPI.clone(GitAPI.java:273)
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1044)
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
        at hudson.FilePath.act(FilePath.java:865)
        at hudson.FilePath.act(FilePath.java:838)
        at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:986)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1142)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1331)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:682)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:587)
        at hudson.model.Run.execute(Run.java:1557)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:236)

我的第一个猜测是,用户jenkins正在运行,因为他没有访问git repo的权限

我会尝试登录到服务器并运行

sudo su <jenkins_user_name>
git clone https://.....
sudo su
git克隆https://.....

如果已经设置了SSH密钥,您可能只需要将服务器添加到已知主机上。

是否可以尝试将远程引用从源代码重命名为其他名称
git远程重命名源代码somethingelse
。然后看看Jenkins是否能够克隆它。请原谅我的基本问题,在我们可以将存储库克隆到本地文件夹之前,我们是否可以执行“git remote rename origin somethingelse”操作?否:
git remote rename
将重命名本地repo使用的远程地址,这意味着您首先需要有本地repo才能执行
git remote rename…
命令。我试图克隆的存储库是公共存储库的分支。当我试图构建作业时,Jenkins抛出了上述错误。因此,我没有本地回购来更改远程引用。我不知道为什么詹金斯夫妇默认将远程引用作为“原点”!