Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (29.3k points)

with github command I have

ssh -T [email protected]

Hi (MyName)! You've successfully authenticated, but GitHub does not provide shell access.

my connection with github is ok no problem, but with jenkins, I have this error

ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:Name-MysRepo/MyRepo.git

hudson.plugins.git.GitException: Could not clone [email protected]:Name-MysRepo/MyRepo.git

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(

    at hudson.plugins.git.GitSCM$2.invoke(

    at hudson.plugins.git.GitSCM$2.invoke(

    at hudson.FilePath.act(

    at hudson.FilePath.act(

    at hudson.plugins.git.GitSCM.determineRevisionToBuild(

    at hudson.plugins.git.GitSCM.checkout(

    at hudson.model.AbstractProject.checkout(

    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(

    at jenkins.scm.SCMCheckoutStrategy.checkout(

    at hudson.model.AbstractBuild$

    at hudson.model.Run.execute(


    at hudson.model.ResourceController.execute(


Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin [email protected]:Name-MysRepo/MyRepo.git /root/.jenkins/jobs/TestKRGDAOV01/workspace" returned status code 128:

stdout: Cloning into '/root/.jenkins/jobs/TestKRGDAOV01/workspace'...

stderr: Permission denied (publickey).

fatal: The remote end hung up unexpectedly

why this problem with publickey I use Jenkins under TomCat7 / ubuntu 12 help me in this issue. 

1 Answer

0 votes
by (50.2k points)

The error that shows in this question indicates that Jenkins is trying to connect git-hub with the wrong ssh key.

To resolve this particular error you need to use:

 Determine the Jenkins user which runs as 'build' or 'Jenkins'

Log on to the Host machine of Jenkins and try to do clone but not on the Jenkins host.

Try to ssh now, If it fails again then you need to add a proper key to /.ssh.

Browse Categories