我无法在jenkins中建立工作,即使我已经为github提供了路径

时间:2015-07-12 11:41:20

标签: java github jenkins

我是詹金斯的新手,我正试图在詹金斯创造一份工作。我把我的项目推送到github,并向jenkins提供了github服务器的路径,但是当我尝试构建工作时,它显示错误而不是构建....请帮助解决...

这是我得到的例外---

Started by user anonymous
Building in workspace C:\Users\hp\.jenkins\jobs\Spring\workspace
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url git@github.com:rishi1020/SpringMVC # timeout=10
Fetching upstream changes from git@github.com:rishi1020/SpringMVC
 > git.exe --version # timeout=10
 > git.exe -c core.askpass=true fetch --tags --progress git@github.com:rishi1020/SpringMVC +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.com:rishi1020/SpringMVC
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:735)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:983)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1016)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: hudson.plugins.git.GitException: Command "git.exe -c core.askpass=true fetch --tags --progress git@github.com:rishi1020/SpringMVC +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout: 
stderr: 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1591)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:86)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:324)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:733)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

3 个答案:

答案 0 :(得分:1)

我怀疑,可能是因为在Jenkins中没有正确配置git。

转到管理Jenkins - >配置,git配置应该如下所示

enter image description here

答案 1 :(得分:0)

看起来不像有效的Github存储库URL。

将此作为您的存储库URL: https://github.com/rishi1020/SpringMVC.git

答案 2 :(得分:0)

我怀疑这是因为您的jenkins服务器无法使用您提供的SSH密钥对与Github通信。

在jenkins从Github中提取代码进行构建之前,首先必须确保git命令可以在命令行中正常运行。

cd C:\Users\hp\.jenkins\jobs\Spring\workspace
git clone git@github.com:rishi1020/SpringMVC

在上面的命令可以正常工作后,你可以回到jenkins继续。