jenkins 报错日志

ERROR: Error fetching remote repo 'origin'hudson.plugins.git.GitException: Failed to fetch from https://gitee.com/xxx/xxx.gitat hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)at java.base/java.util.concurrent.FutureTask.run(Unknown Source)at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)at java.base/java.lang.Thread.run(Unknown Source)Caused by: hudson.plugins.git.GitException: Command "git config remote.origin.url https://gitee.com/xxx/xxx.git" returned status code 128:stdout: stderr: fatal: not in a git directoryat org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2766)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2761)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2063)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1662)at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:180)at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:987)... 11 more

解决方法

执行以下命令(如果是容器化部署,直接进入容器执行)

git config --global --add safe.directory '*'