Jenkins检出GIT项目失败,显示“权限被拒绝”、“无法分叉”。

4
我有一个Freestyle Jenkins项目,使用SSH作为协议和私钥(而不是用户名/密码)来使用Bitbucket作为源码管理。
当我在主节点上构建该项目时,会出现以下堆栈跟踪错误,而在代理上则可以正常运行。
注意到错误提到:
stderr: fatal: cannot exec '/var/lib/jenkins/workspace/foo_test@tmp/ssh1377177620135545595.sh': Permission denied fatal: unable to fork
我检查了以下内容:
- 以jenkins用户身份从命令行运行此命令没有问题。 - 文件夹/var/lib/jenkins/workspace/foo_test@tmp可被Jenkins写入。 - 我正在使用Git Client 2.7.4的最新版本。 问题可能是什么? 堆栈跟踪:
    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

这个帖子对我有用,因为我在Ubuntu 22中。 - Camilo A. Hernández
1个回答

5

这个可以了。最近的更改中不小心添加了noexec,导致无法执行任何脚本。 - Hari Ennekat

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接