Caused by: hudson.plugins.git.GitException: Command “git fetch –tags –force –progress — https://gitlab.xxx.com/xx.git +refs/heads/*:refs/remotes/origin/*” returned status code 128:
在Jenkins构建过程中出现如下错误:
> git --version # timeout=10 > git --version # 'git version 2.25.1' using GIT_ASKPASS to set credentials Jenkins gitlab 凭证 > git fetch --tags --force --progress -- https://gitlab.xxx.com/xxx.git +refs/heads/*:refs/remotes/origin/* # timeout=10 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://gitlab.xxx.com/xxx.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1006) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1248) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1312) 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(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://gitlab.xxx.com/xxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
Jenkins通过agent在目标k8s集群上进行代码克隆,但是无法克隆。
目标k8s服务器:
系统版本:Ubuntu 20.04.5 LTS
上git版本:git version 2.25.1
通过单独的测试:
在 Ubuntu 20.04.5 LTS 上 git version 2.25.1 单独克隆也无法成功
在 Ubuntu 22.04.1 LTS 上 git version 2.34.1 单独克隆可以成功
考虑将 Ubuntu 20 上的 git 进行升级。
Ubuntu 20上通过apt install git 最新版本为 git version 2.25.1 ,需要卸载掉原有的git 2.25.1 再进行源码安装:
卸载 老的 git 2.25.1:
apt remove git
源码安装:
参考文档:https://cloud.tencent.com/developer/article/1623041
# 下载 wget -c https://github.com/git/git/archive/refs/tags/v2.36.4.tar.gz -O - | sudo tar -xz -C /usr/src # 安装依赖 apt-get install zlib1g-dev libssl-dev apt-get install libexpat1-dev libcurl4-openssl-dev apt-get install build-essential tcl tk gettext apt-get install gcc make # 安装 cd /usr/src/git-* sudo make prefix=/usr/local all sudo make prefix=/usr/local install # 查看版本 # git version git version 2.34.6
再次执行构建,成功。
共有 0 条评论