Jenkins无法从安装在同一服务器上的git存储库中获取,请在box上成功执行命令



这是一个奇怪的问题,我们已经尝试了stackoverflow的可能解决方案,但仍然无法解决。在SA的周末补丁和重新启动后,我们的jenkins作业无法构建。。。

Console output for all projects-
> /usr/bin/git fetch --tags --progress /home/user/repositories/git/user.git
+refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from /home/user/
repositories/git/user.git
    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:484)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1270)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
AbstractBuild.java:609)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.
java:531)
    at hudson.model.Run.execute(Run.java:1717)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:537)
    at hudson.model.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --
tags --progress /home/user/repositories/git/user.git +refs/heads/*:refs/
remotes/origin/*" returned status code 128:
stdout: 
stderr: error: cannot run git-upload-pack '/home/user/repositories/git/user.
git': No such file or directory
fatal: unable to fork
    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
  1. gitrepository和jenkins在同一台服务器上,不应该使用ssh。源代码管理将存储库URL配置为/home/user/restores/git/user.gitgit存储库对所有用户都是可读写的。

  2. 以jenkins的身份登录服务器,运行

/usr/bin/git fetch--标记--进度/home/user/repositories/git/user.git+refs/heads/:refs/remotes/origin/

它可以在没有任何问题的情况下成功地从git存储库中获取。

  1. 升级jenkins至1.600,GIT客户端插件至1.17.1,GIT插件至2.3.5仍然不起作用

  2. 新建项-自由式项目,gradle项目,在配置系统中没有指定JDK,可以在构建时获取-

    从/home/user/restores/git/user.git 获取上游更改

    /usr/bin/git--版本#超时=10

    /usr/bin/gitfetch--标记--progress/home/user/restores/git/user.git+refs/heads/:refs/remotes/origin/

    /usr/bin/git-rev解析refs/remotes/origin/master^{commit}#超时=10

    /usr/bin/git-rev解析refs/remotes/origin/oorigin/master^{commit}#超时=10检出修订版c6223c5c4693dc9be933b9e4b2fa915fea311891(参考文献/遥控器/原点/主坐标(/usr/bin/git-config-core.sparcecheckout#超时=10

    /usr/bin/git checkout-f c6223c5c4693dc9be933b9e4b2fa915fea311891

    /usr/bin/git rev-list 050ac61d242b61ab88f533932820cab4e44db7b7#超时=10[Gradle]-启动构建。[项目]$/var/lib/jenkins/tools/hudson.plugins.gradle.gradle安装/主/料仓/级配错误:未设置JAVA_HOME,在您的路径。

指定JDK后,jenkins无法从git中获取,错误相同

  1. 新的Maven项目无法工作,相同的错误

  2. 检查新maven项目的工作空间-其中只有一个".git"文件夹分支挂钩信息对象参考文献config 156 B视图描述73 B视图FETCH_HEAD 0 B视图HEAD 23 B视图

检查新的自由风格项目的工作空间-

.git
.settings
PROJECT
.gitignore  329 B    view
.project    385 B   
  1. SA表示,补丁是针对unix核心和rsyslog的,与jenkins和git似乎无关

关于我们还可以检查什么来解决这个问题,有什么建议吗?谢谢

您可能不应该以这种方式使用共享的可写Git repo。如果您的某些目录没有共享的可写或可执行位,那么其他用户将无法进入这些目录。

也就是说,这里给出了错误消息:

stderr: error: cannot run git-upload-pack  '/home/user/repositories/git/user.git': No such file or directory

它看起来没有显示为目录,或者Jenkins作业无法读取它。对该名称运行ls-lR,看看它是否会显示一个列表,如果是,是否所有目录都有正确的权限位,允许"其他"对其进行读/写(或者包括Jenkins在内的所有用户都在一个合适的组中,并且是组读/写(。

我遇到了同样的问题,这是由Jenkins插件EnvInject引起的。在我删除了那个插件之后,一切都开始工作了。JDK的配置为什么会搞砸,这对我来说是个谜,但绝对的根本原因是EnvInject本身。

我遇到的另一个问题是我没有正确配置git二进制:管理Jenkins->配置系统->Git->Git可执行文件的路径。在我将值更改为git的绝对位置(/usr/bin/git(后,一切都开始工作了。

相关内容

最新更新