Caused by: hudson.plugins.git.GitException: Command “git fetch --tags --progress -- https://github.

博主在尝试使用Jenkins从GitHub拉取代码时遇到错误,问题源于GitHub不再支持账号密码验证,而采用Access Tokens。通过生成并使用Access Token,成功解决了拉取代码的问题。解决方案包括在Jenkins全局凭据中添加token或者直接在Git URL中使用token。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一.问题描述:

由于最近一直在搞java开发,没怎么搞cicd了,突然想搞搞自己的项目,所以跑了一下jenkins,却发现原来搭好的job执行失败,GitHub上面的代码拉不下来

ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/xxx.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:996)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1237)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1297)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress --  https://github.com/xxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: unable to access ' https://github.com/xxx.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:573)
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:994)
	... 11 more

二.问题分析:

首先我更新了一下Jenkins里面的全局凭据,但是结果还是拉取不了,突然想到八月份github出了新的验证政策,不再支持账号密码验证,采用access tokens的方式。所以换授权码试了一下,果然可以

三.问题解决

1.在GitHub生成token

2.后面可以采用两种方式

第一种:可以在Jenkins全局凭据配置中,增加一个username-password凭据,用户名可以随便写,密码输入保存好的token

第二种: 将token写入git的url里面,就不需要凭据了

 

 

 

 

 

回答: Hudson.plugins.gitJenkins的一个插件,用于支持Git版本控制系统。它允许JenkinsGit仓库中拉取代码,并在构建过程中进行版本控制。通过配置JenkinsGit插件,可以实现自动化部署任务,包括拉取代码、构建项目和部署到测试环境等步骤。\[3\]在你的问题中,你提到了更新Jenkins的全局凭据和使用授权码来解决拉取代码的问题,这可能是因为GitHub在八月份更新了验证政策,不再支持账号密码验证,而是采用access tokens的方式\[1\]。此外,你还提到了一个典型的自动化部署任务过程,其中包括了杀死Tomcat进程、清理项目、构建项目等步骤\[2\]。总的来说,Hudson.plugins.git插件是Jenkins中用于支持Git版本控制系统的插件,可以帮助实现自动化部署任务。 #### 引用[.reference_title] - *1* [Caused by: hudson.plugins.git.GitException: Commandgit fetch --tags --progress -- https://github.](https://blog.csdn.net/yiye2017zhangmu/article/details/120556053)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [jenkins报错hudson.plugins.git.GitException: Could not init /root/.jenkins/workspace/DeployOrder/...](https://blog.csdn.net/gwdgwd123/article/details/107043828)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值