Unable to access private git repositories using Hu

2019-05-29 13:07发布

I'm getting the below error:

Started by user anonymous
Checkout:workspace / /var/lib/hudson/jobs/test2/workspace - hudson.remoting.LocalChannel@1e77243d
Using strategy: Default
Checkout:workspace / /var/lib/hudson/jobs/test2/workspace - hudson.remoting.LocalChannel@1e77243d
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:rampelli/test.git
ERROR: Cause: Exception caught during execution of fetch command
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
        at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:913)
        at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:845)
        at hudson.FilePath.act(FilePath.java:758)
        at hudson.FilePath.act(FilePath.java:740)
        at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:845)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:622)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1479)
        at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:507)
        at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:424)
        at hudson.model.Run.run(Run.java:1366)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:145)

Without generating the ssh-keygen I was able to access public git Repositories, but after adding ssh-keygen I was unable to access private git repositories.

标签: git hudson
1条回答
兄弟一词,经得起流年.
2楼-- · 2019-05-29 13:45

Its fixed by just moving the .ssh folder to /var/lib/hudson/ folder and giving hudson access to .ssh files by just chown hudson:hudson .ssh/* It worked :)

查看更多
登录 后发表回答