1

我似乎无法让 git 插件在 Jenkins 上运行。已搜索并尝试了所有可能的建议解决方案。

我已经正确设置了 Git、Putty plink、环境变量、ssh 密钥。

命令行中的 Git 或 Git Bash 可以正常工作。我可以运行 Jenkins 尝试运行的所有命令并且没有任何问题。

我在 c:\Documents and Settings\Administrator 和 C:\Program Files\Git 都有一个 .ssh 文件夹的副本。

Jenkins windows 服务以管理员帐户运行,与本地系统相反。

当 Jenkins 开始构建时,我不断收到错误消息:没有支持的身份验证方法可用。这看起来像 Jenkins 无法在 .ssh 文件夹中找到密钥。

希望有人可以提供帮助。

Started by user anonymous
Building in workspace C:\websites\companya\ci\ci1build
Checkout:ci1build / C:\websites\companya\ci\ci1build - hudson.remoting.LocalChannel@1b2bb77
Using strategy: Default
Fetching changes from 1 remote Git repository
Fetching upstream changes from git@github.com:companya/companya.git
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
hudson.plugins.git.GitException: Command "git.exe fetch -t git@github.com:companya/companya.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: trace: built-in: git 'fetch' '-t' 'git@github.com:companya/companya.git' '+refs/heads/*:refs/remotes/origin/*'
trace: run_command: 'C:\Program Files\PuTTY\plink.exe' '-batch' 'git@github.com' 'git-upload-pack '\''companya/companya.git'\'''
FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
fatal: The remote end hung up unexpectedly

    at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:818)
    at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:780)
    at hudson.plugins.git.GitAPI.fetch(GitAPI.java:196)
    at hudson.plugins.git.GitAPI.fetch(GitAPI.java:1026)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:812)
    at hudson.plugins.git.GitSCM.access$100(GitSCM.java:90)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1096)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
    at hudson.FilePath.act(FilePath.java:842)
    at hudson.FilePath.act(FilePath.java:824)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1245)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
    at hudson.model.Run.execute(Run.java:1488)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)
ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1103)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
    at hudson.FilePath.act(FilePath.java:842)
    at hudson.FilePath.act(FilePath.java:824)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1245)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
    at hudson.model.Run.execute(Run.java:1488)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)
4

2 回答 2

0

它找不到您的私钥(也许您正在以不同的用户身份运行?)。

根据 Git 插件文档,您可以使用 home 环境变量

HOME => SSH 密钥所在的文件夹(例如 C:\SSHKeys)

于 2012-07-11T06:02:12.373 回答
0

尝试从控制台运行 Jenkins,而不是作为服务运行。

于 2012-07-11T05:46:32.750 回答