gpt4 book ai didi

git - 标准错误 : fatal: cannot exec '/tmp/ssh**.sh' : Permission denied fatal: unable to fork

转载 作者:行者123 更新时间:2023-12-03 18:36:04 27 4
gpt4 key购买 nike

我在尝试执行 Jenkins 作业时看到错误。

git 版本 1.8.3.1
Jenkins 2.46.2.1-滚动

我尝试将 git 升级到更高版本,但仍然通过关注 How to install latest version of git on CentOS 6.x/7.x 挂起 1.8.3.1链接。授予/tmp 权限也不起作用

我的 RHEL7 服务器来自 AWS。

构建 Jenkins 作业时的错误日志 -

 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@git.devops.company.net:user/project_test.git # timeout=10
Fetching upstream changes from git@git.devops.company.net:user/project_test.git
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --tags --progress git@git.devops.company.net:user/project_test.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@git.devops.company.net:user/project_test.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:806)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1070)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@git.devops.company.net:user/project_test.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: cannot exec '/tmp/ssh2653538317929125933.sh': Permission denied
fatal: unable to fork

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1793)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1519)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at ......remote call to zz_server_IP(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
at hudson.remoting.Channel.call(Channel.java:830)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.GeneratedMethodAccessor1953.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
at com.sun.proxy.$Proxy140.execute(Unknown Source)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:804)
... 13 more

最佳答案

Jenkins git 客户端插件使用临时目录中的文件将凭据传递给命令行 git。如果选择的临时目录挂载了 noexec选项,则不允许命令行 git 从临时目录执行脚本。 git fetch将失败并显示堆栈跟踪,因为命令行 git 没有收到所需的凭据。

自 2.4.4(2017 年 4 月 24 日发布)以来的 Git 客户端插件版本尝试在 Jenkins 作业环境中使用临时目录。如果 Jenkins 作业环境不可用,则使用系统临时目录。

解决问题的替代方法包括:

  • 在启动 Jenkins 的脚本中声明不同的系统临时目录(无论是/etc/init.d 还是 Windows 或 shell 脚本):java -Djava.io.tmpdir=/path/to/tmpdir jenkins.war
  • 为 Jenkins ssh 代理声明一个不同的临时目录作为代理的“高级”部分中配置的 JVM 选项:-Djava.io.tmpdir=/path/to/tmpdir
  • 在启动 JNLP 代理的命令行上声明一个不同的 Jenkins JNLP 代理临时目录作为 JVM 选项:java -Djava.io.tmpdir=/path/to/tmpdir agent.jar -jnlpUrl http://jenkins.example.com:8080/computer/my-agent/slave-agent.jnlp -secret MY-SECRET
  • 使用 JGit implementation在 Jenkins git 客户端插件中而不是命令行 git
  • 挂载不带 noexec 的系统临时文件系统选项
  • 关于git - 标准错误 : fatal: cannot exec '/tmp/ssh**.sh' : Permission denied fatal: unable to fork,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49074728/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com