Jenkins检出GIT项目失败,权限被拒绝致命:无法分叉 [英] Jenkins checkout of GIT project fails with Permission denied fatal: unable to fork

查看:513
本文介绍了Jenkins检出GIT项目失败,权限被拒绝致命:无法分叉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Freestyle Jenkins项目,该项目使用bitbucket作为SCM,并使用ssh作为协议和私钥(而不是用户/密码).

I have a Freestyle Jenkins project that uses bitbucket as SCM with ssh as protocol and private key (not user/password).

当我在master上构建项目时,它在堆栈跟踪下面失败,而在代理上运行正常.

When I build the project on master it fails with below stacktrace, while it runs fine on agent.

注意错误提示:

stderr:致命:无法执行'/var/lib/jenkins/workspace/foo_test@tmp/ssh1377177620135545595.sh':权限被拒绝 致命:无法分叉

stderr: fatal: cannot exec '/var/lib/jenkins/workspace/foo_test@tmp/ssh1377177620135545595.sh': Permission denied fatal: unable to fork

我检查了以下内容:

  • 从命令行以jenkins用户身份运行此文件不会出现任何问题.
  • Jenkins可以写入/var/lib/jenkins/workspace/foo_test @ tmp文件夹
  • 我正在使用最新版本的 Git客户端 2.7.4
  • Running this as jenkins user from command line shows no problem.
  • The folder /var/lib/jenkins/workspace/foo_test@tmp is writable by Jenkins
  • I am using last version of Git Client 2.7.4

可能是什么问题?

Stacktrace:

Stacktrace:

    Started by user unknown or anonymous
    Building on master in workspace /var/lib/jenkins/workspace/foo_test
    [WS-CLEANUP] Deleting project workspace...
    [WS-CLEANUP] Deferred wipeout is used...
    Cloning the remote Git repository
    Cloning repository ssh://git@bitbucket.foo.com:7999/~xxx/foo_poc.git
    > git init /var/lib/jenkins/workspace/foo_test # timeout=10
    Fetching upstream changes from ssh://git@bitbucket.foo.com:7999/~xxx/foo_poc.git
    > git --version # timeout=10
    using GIT_SSH to set credentials
     > git fetch --tags --progress ssh://git@bitbucket.foo.com:7999/~xxx/foo_poc.git +refs/heads/*:refs/remotes/origin/*
    ERROR: Error cloning remote repo 'origin'
    hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://git@bitbucket.foo.com:7999/~xxx/foo_poc.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
    stdout:
    stderr: fatal: cannot exec '/var/lib/jenkins/workspace/foo_test@tmp/ssh1377177620135545595.sh': Permission denied
    fatal: unable to fork
            at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016)
            at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735)
            at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
            at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420)
            at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:629)
            at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1146)
            at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
            at hudson.scm.SCM.checkout(SCM.java:504)
            at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
            at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
            at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
            at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
            at hudson.model.Run.execute(Run.java:1819)
            at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
            at hudson.model.ResourceController.execute(ResourceController.java:97)
            at hudson.model.Executor.run(Executor.java:429)
    ERROR: Error cloning remote repo 'origin'
    Finished: FAILURE

推荐答案

检查是否未使用'noexec'选项挂载了主服务器上的工作区目录.

Check that the workspace directory on the master is not mounted with the 'noexec' option.

  • 查看/etc/fstsab来找到那些设置
  • 删除noexec
  • 重启机器

有关更多信息,请参见马克·怀特(Mark Waiter)的精彩解答

See for more information this great answer by Mark Waiter

这篇关于Jenkins检出GIT项目失败,权限被拒绝致命:无法分叉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆