无法使用Hudson访问私有git存储库

问题描述:

我收到以下错误:

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)

没有生成ssh-keygen,我可以访问公共git存储库,但是在添加ssh-keygen之后,我无法访问私有git存储库.

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.

已通过将.ssh文件夹移动到/var/lib/hudson/文件夹,并使chod hudson:hudson使hudson访问.ssh文件而得到修复. ssh/*有效:)

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 :)