• jenkins 拉取git仓库报错: stderr: fatal: not in a git directory


    jenkins 报错日志

    ERROR: Error fetching remote repo 'origin'
    hudson.plugins.git.GitException: Failed to fetch from https://gitee.com/xxx/xxx.git
    	at 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 directory
    
    	at 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27

    解决方法

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

    git config --global --add safe.directory '*'
    
    • 1
  • 相关阅读:
    【RabbitMQ实战】05 RabbitMQ后台管理
    java88-Charactor包装类
    牛客练习赛106
    解决jupyter下载好了库,但是无法使用的问题。以及补充jupyter如何下载新的库。
    链表编程题题解
    35分钟了解sql注入-盲注(三)
    A - Til the Cows Come Home
    基础矩阵F的计算(2D-2D)
    英语语法强化
    【开源三方库】Easyui:基于OpenAtom OpenHarmony ArkUI深度定制的组件框架
  • 原文地址:https://blog.csdn.net/qq_36940806/article/details/136719683