Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
1 view
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(CliGitAPIImpl.java:219)

    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1001)

    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:942)

    at hudson.FilePath.act(FilePath.java:904)

    at hudson.FilePath.act(FilePath.java:877)

    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:942)

    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)

    at hudson.model.AbstractProject.checkout(AbstractProject.java:1369)

    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)

    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)

    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)

    at hudson.model.Run.execute(Run.java:1575)

    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)

    at hudson.model.ResourceController.execute(ResourceController.java:88)

    at hudson.model.Executor.run(Executor.java:241)

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

...