jenkins创建推送Git tag出错

项目场景:

linux环境下jenkins部署发布

问题描述:

jenkins构建项目创建推送git tag时遇到的报错

> /usr/local/git/bin/git tag -l release-zjt-pro-41 # timeout=10
> /usr/local/git/bin/git tag -a -f -m tag.....标签 release-zjt-pro-41 # timeout=10
ERROR: Failed to push tag release-zjt-pro-41 to origin
hudson.plugins.git.GitException: Could not apply tag release-zjt-pro-41
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.tag(CliGitAPIImpl.java:1804)
	at hudson.plugins.git.GitAPI.tag(GitAPI.java:287)
	at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:258)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1074)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
	at hudson.model.Run.execute(Run.java:1919)
	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:428)
Caused by: hudson.plugins.git.GitException: Command "/usr/local/git/bin/git tag -a -f -m tag.....标签 release-zjt-pro-41" returned status code 128:
stdout: 
stderr: 
*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'jenkins@gf_zjqd_prd_app.(none)')

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2380)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2376)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1923)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1935)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.tag(CliGitAPIImpl.java:1802)
	... 11 more
Build step 'Git Publisher' marked build as failure

原因分析:

1.jenkins上git工具配置问题
2.linux中ssh问题(使用ssh连接Git)


解决方案:

1.检查jenkins中git配置
在这里插入图片描述
这里我Git配置没问题,就试下面方法~

2.配置git ssh
在这里插入图片描述
结果还是报同样的错误…

3.在项目的源码管理中设置git username和email
在这里插入图片描述

这样设置,项目构建就OK了,git tag也可以正常创建并推送至git远程~

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值