简体   繁体   English

Jenkins Git集成

[英]Jenkins Git integration

I'm new to Jenkins and installed it on my local windows machine. 我是Jenkins的新手,并将其安装在本地Windows机器上。

I've installed the git plugin, and configured it together, but when trying to run build, it fails with the following exception: 我已经安装了git插件,并将其一起配置,但是在尝试运行build时,它失败,但出现以下异常:

Started by user anonymous Building in workspace C:\\workPrograms\\jenkins\\jobs\\server1\\workspace 由用户匿名开始在工作空间C:\\ workPrograms \\ jenkins \\ jobs \\ server1 \\ workspace中构建

git.exe rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository git.exe config remote.origin.url http://mygit.com/backend/server.git # timeout=10 Fetching upstream changes from http://mygit.com/backend/server.git git.exe --version # timeout=10 git.exe -c core.askpass=true fetch --tags --progress http://mygit.com/backend/server.git +refs/heads/ :refs/remotes/origin/ ERROR: Timeout after 10 minutes ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from http://mygit.com/backend/server.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097) at hudson.scm.SCM.checkout(SCM.java:485) at hudson.model.AbstractProject.checkout(AbstractProject.java:1269) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMChecko git.exe rev-parse --is-inside-work-tree#timeout = 10从远程Git存储库获取更改git.exe config remote.origin.url http://mygit.com/backend/server.git#超时= 10从http://mygit.com/backend/server.git git.exe --version#timeout = 10 git.exe -c core.askpass = true提取上游-标记-进度--http:// mygit.com/backend/server.git + refs / heads / :refs / remotes / origin /错误:10分钟后超时错误:提取远程仓库“ origin”时出错hudson.plugins.git.GitException:无法从http获取: //位于hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)上的mygit.com/backend/server.git,位于hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)上的hudson.plugins.git。 hudson.scm上的git.GitSCM.checkout(GitSCM.java:1097)在hudson.model.AbstractProject.checkout(AbstractProject.java:1269)上的hudson.model.AbstractBuild $ AbstractBuildExecution上的SCM.checkout(SCM.java:485)在jenkins.scm的.defaultCheckout(AbstractBuild.java:607).SCMCheckoutStrategy.checkout(SCMChecko utStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1738) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: hudson.plugins.git.GitException: Command "git.exe -c core.askpass=true fetch --tags --progress http://mygit.com/backend/server.git +refs/heads/ :refs/remotes/origin/ " returned status code -1: stdout: stderr: at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808) ... 11 more ERROR: null Finished utStrategy.java:86)在hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:529)在hudson.model.Run.execute(Run.java:1738)在hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java) :531)在hudson.model.ResourceController.execute(ResourceController.java:98)在hudson.model.Executor.run(Executor.java:410)造成原因:hudson.plugins.git.GitException:命令“ git.exe- c core.askpass = true获取--tags --progress http://mygit.com/backend/server.git + refs / heads / :refs / remotes / origin / “返回状态码-1:stdout:stderr:at位于org.jenkinsciclients的org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)上的org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)at org.jenkinsciclient。 (CliGitAPIImpl.java:63)在org.jenkinsci.plugins.gitclient.CliGitAPIImpl $ 1.execute(CliGitAPIImpl.java:314)在hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)... 11更多错误:null已完成 : FAILURE :失败

running the same commands from command line works without a problem. 从命令行运行相同的命令可以正常工作。

what am I missing here? 我在这里想念什么?

Aviad 阿维亚德

Check if there is any proxy setting done on system. 检查系统上是否有任何代理设置。 Check if environment variable " http_proxy " or " https_proxy " is set. 检查是否设置了环境变量“ http_proxy ”或“ https_proxy ”。 It might be the case that http_proxy environment variable it set, that's why you are able to clone/access the repository from command line. 它可能设置了http_proxy环境变量,这就是为什么您能够从命令行克隆/访问存储库的原因。

In case proxy is set then you need to set the proxy in jenkins as well. 如果设置了代理,那么您还需要在詹金斯中设置代理。 Set http proxy on 将http代理设置为

"Jenkins -> Manage Jenkins -> Manage Plugins -> Advanced Tab".

well cloning http://mygit.com/backend/server.git times out -- either the URL is wrong or it takes over 10m. 克隆http://mygit.com/backend/server.git超时-URL错误或超过10m。

Since you say entering the command on the CLI works, it must be the 10m timeout. 由于您说在CLI上输入命令有效,因此它必须是10m超时。 That can easily be changed in the jenkins UI by adding advanced checkout or advanced clone behaviors and defining a value for the timeout -- eg 30 通过添加高级检出或高级克隆行为并定义超时值,可以在jenkins UI中轻松更改此值-例如30

see also: https://issues.jenkins-ci.org/browse/JENKINS-20445 另请参阅: https : //issues.jenkins-ci.org/browse/JENKINS-20445

for me, I had to set it to 30m once ;) 对我来说,我必须将它一次设置为30m;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM