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

一.问题描述:

由于最近一直在搞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里面,就不需要凭据了

猜你喜欢

转载自blog.csdn.net/yiye2017zhangmu/article/details/120556053