Jenkins和Gitlab不会获取代码

时间:2017-11-21 16:09:26

标签: jenkins gitlab

我设置自己的项目时遇到问题。 我开始配置我的Jenkins Job,我这样做了:

  • 在Jenkins上为gitlab用户帐户创建凭据
  • 在gitlab上创建访问令牌,并在Jenkins中使用此令牌启用它

enter image description here

这是作业配置 enter image description here

但是当我开始构建时,10分钟后我收到此错误

Started by user admin
Building in workspace /Users/Shared/Jenkins/Home/workspace/xxxxxxxxx
 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /usr/bin/git config remote.origin.url https://gitlab.xxxxxxxxx.git # timeout=10
Fetching upstream changes from https://xxxxxxxx.git
 > /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/bin/git fetch --tags --progress https://xxxxxxxxxx.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 https://gitlab.xxxxxxx.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:825)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1092)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
    at hudson.scm.SCM.checkout(SCM.java:495)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:566)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:491)
    at hudson.model.Run.execute(Run.java:1737)
    at hudson.matrix.MatrixBuild.run(MatrixBuild.java:314)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:421)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://xxxxxxxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1970)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1689)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:380)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:823)
    ... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

那么......我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

选中“高级克隆行为”下的“克隆和获取操作的超时(以分钟为单位)”选项 默认超时为10分钟。

答案 1 :(得分:0)

我想解决这个问题。按照本指南添加和启用jenkins用户http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/

而且,此刻,有效。谢谢大家