简体   繁体   中英

Unable to clone repository to jenkins on linux

I am able to clone a repository that i've created for one of my jobs on jenkins. Whereas, cloning a repository which is a fork of another repository gives the following error when trying to build it - Any suggestions on what could be the problem?

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)

My first guess would be that the user jenkins is running as does not have permission to access the git repo.

I would try logging into the server and running

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

You may just need to add the server to your known hosts if the SSH Keys are already setup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM