项目场景:
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远程~